【发布时间】:2022-04-22 05:30:29
【问题描述】:
我对 Azure DevOps 有点陌生。我知道我们可以进行 XML 转换和 JSON 变量替换。我们可以在库中定义键、值和 json 变量,并在发布管道中更新。有什么方法可以像替换任何文件(config,json)中的变量值一样。例如,我定义了一个库值(hello = world),发布管道任务将在 config、json 文件中查找并替换 $hello 并将其替换为“world”。 我正在尝试使用如下替换标记。
是的,我也在看。看起来它没有替换值。您是否看到以下任何配置问题
步骤:
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace tokens in **/*.config **/*.json'
inputs:
targetFiles: |
**/*.config
**/*.json
verbosity: detailed
tokenPrefix: '{'
tokenSuffix: '}'
如下记录
2020-05-11T18:44:01.6149125Z ##[section]Starting: Replace tokens in **/*.config **/*.json
2020-05-11T18:44:01.6363261Z ==============================================================================
2020-05-11T18:44:01.6363986Z Task : Replace Tokens
2020-05-11T18:44:01.6364452Z Description : Replace tokens in files
2020-05-11T18:44:01.6364873Z Version : 3.6.0
2020-05-11T18:44:01.6365252Z Author : Guillaume Rouchon
2020-05-11T18:44:01.6365919Z Help : v3.6.0 - [More Information](https://github.com/qetza/vsts-replacetokens-task#readme)
2020-05-11T18:44:01.6366694Z ==============================================================================
2020-05-11T18:44:02.2020864Z pattern: \{\s*((?:(?!\{)(?!\s*\}).)*)\s*\}
2020-05-11T18:44:02.2247835Z replaced 0 tokens out of 0 in 0 file(s) in 0.04 seconds.
2020-05-11T18:44:03.1202699Z ##[section]Finishing: Replace tokens in **/*.config **/*.json
图书馆价值
myhello = Hello
appsetngs.config 中的值
<section name="{myhello}" type="Exceptionless.ExceptionlessSection, Exceptionless" />
【问题讨论】:
标签: azure-devops azure-pipelines azure-pipelines-release-pipeline