VS 2017 Release Management Tokenize XPath/Regular 表达式不起作用
VS 2017 Release Management Tokenize XPath/Regular expressions not working
我正在尝试使用 Release Management Tokenize XPath/Regular,但我在尝试回答三个条目时不断收到不同的错误
源文件名: $(System.DefaultWorkingDirectory)/XXXXX/Drop - 我知道在我的构建服务器上这个文件应该是
xxxxxx.exe.config 并且位于一个 zip 文件中
目标文件名:不知道这个应该放在构建服务器还是发布服务器上?
Configuration Json filename: 不知道放哪了,下面的代码就是Json文件.
{
"DEV":{
"ConfigChanges": [{
"KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']",
"Attribute": "emailListId",
"value": 0
},
{
"KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']",
"Attribute": "subjectLineStarter",
"value": "[DEV]: Program Name"
},
{
"KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']",
"Attribute": "smtpServer",
"value": "testsmtp.dns.com"
},
{
"KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']",
"Attribute": "toAddress",
"value": "application.support.test@Yahoo.com"
}]
}
}
我的错误
2019-04-01T16:40:08.4509133Z ##[section]Starting: Tokenizer: Transform Source filename
2019-04-01T16:40:08.4663688Z ==============================================================================
2019-04-01T16:40:08.4663688Z Task : Tokenize with XPath/Regular expressions
2019-04-01T16:40:08.4663688Z Description : Replaces __<variable>__ and/or XPath for XML documents with User Defined variables or configuration json document
2019-04-01T16:40:08.4663688Z Version : 2.1.0
2019-04-01T16:40:08.4663688Z Author : ms-devlabs
2019-04-01T16:40:08.4663688Z Help : [More Information](https://github.com/openalm/Extension-UtilitiesPack)
2019-04-01T16:40:08.4663688Z ==============================================================================
2019-04-01T16:40:10.6850718Z Environment: DEV
2019-04-01T16:40:10.8413250Z Updating emailListId of /configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']: 0
2019-04-01T16:40:10.9350669Z ##[error]Failure while updating emailListId of /configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']: 0
2019-04-01T16:40:10.9663179Z ##[section]Finishing: Tokenizer: Transform Source filename
在我的 .proj 文件中,我放了这个以便我可以在发布时获得 App.Config.Token 文件而不是 App.Config。
<ItemGroup>
<None Include="App.config" />
<None Include="App.Debug.config">
<DependentUpon>App.config</DependentUpon>
</None>
<None Include="App.config.Token">
<DependentUpon>App.config</DependentUpon>
</None>
</ItemGroup>
App.config 和 App.Debug.config 是相同的。
App.Config.Token
这是我们当前使用的标记化过程(我们不压缩构建结果,请参阅下面的扩展建议):
构建:
将App.Config替换为App.Config.Token,例如命令行中的复制命令-task.
发布
每个 environment/stage:
- 对 .config 使用 "Replace Tokens" 扩展名。这从发布定义中读取特定于环境的变量并替换 .config 中的标记(在构建中由 .config.token 替换)
- 进行部署
替换存档中的令牌需要不同的扩展,Tokenize in archive might be an option there. We use Colin's Build and Release tools, which has nifty tokenizator for json-files. I prefer Colin's tokenizer, as it's pretty straightforward and one doesn't have to dabble with XPATH and transformations. We also use Json to Variables 用于在 VC 中存储环境变量,而不是将它们存储在发布定义中。我怀疑最后一个在 TFS 2017 中不起作用,但还没有尝试过。
至于最初的问题,我怀疑您使用的扩展程序无法从存档中读取您尝试标记化的文件。我自己没有使用过该扩展,但我将 JSON 文件放入版本控制,因此它最终出现在构建工件中。目标文件名意味着扩展可以写出最终的配置文件,可能会替换原来的 app.config.
我正在尝试使用 Release Management Tokenize XPath/Regular,但我在尝试回答三个条目时不断收到不同的错误
源文件名: $(System.DefaultWorkingDirectory)/XXXXX/Drop - 我知道在我的构建服务器上这个文件应该是 xxxxxx.exe.config 并且位于一个 zip 文件中
目标文件名:不知道这个应该放在构建服务器还是发布服务器上?
Configuration Json filename: 不知道放哪了,下面的代码就是Json文件.
{ "DEV":{
"ConfigChanges": [{ "KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']", "Attribute": "emailListId", "value": 0 }, { "KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']", "Attribute": "subjectLineStarter", "value": "[DEV]: Program Name" }, { "KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']", "Attribute": "smtpServer", "value": "testsmtp.dns.com" }, { "KeyName": "/configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']", "Attribute": "toAddress", "value": "application.support.test@Yahoo.com" }] }
}
我的错误
2019-04-01T16:40:08.4509133Z ##[section]Starting: Tokenizer: Transform Source filename
2019-04-01T16:40:08.4663688Z ==============================================================================
2019-04-01T16:40:08.4663688Z Task : Tokenize with XPath/Regular expressions
2019-04-01T16:40:08.4663688Z Description : Replaces __<variable>__ and/or XPath for XML documents with User Defined variables or configuration json document
2019-04-01T16:40:08.4663688Z Version : 2.1.0
2019-04-01T16:40:08.4663688Z Author : ms-devlabs
2019-04-01T16:40:08.4663688Z Help : [More Information](https://github.com/openalm/Extension-UtilitiesPack)
2019-04-01T16:40:08.4663688Z ==============================================================================
2019-04-01T16:40:10.6850718Z Environment: DEV
2019-04-01T16:40:10.8413250Z Updating emailListId of /configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']: 0
2019-04-01T16:40:10.9350669Z ##[error]Failure while updating emailListId of /configuration/loggingConfiguration/listeners/add[@name='Email Trace Listener']: 0
2019-04-01T16:40:10.9663179Z ##[section]Finishing: Tokenizer: Transform Source filename
在我的 .proj 文件中,我放了这个以便我可以在发布时获得 App.Config.Token 文件而不是 App.Config。
<ItemGroup>
<None Include="App.config" />
<None Include="App.Debug.config">
<DependentUpon>App.config</DependentUpon>
</None>
<None Include="App.config.Token">
<DependentUpon>App.config</DependentUpon>
</None>
</ItemGroup>
App.config 和 App.Debug.config 是相同的。 App.Config.Token
这是我们当前使用的标记化过程(我们不压缩构建结果,请参阅下面的扩展建议):
构建:
将App.Config替换为App.Config.Token,例如命令行中的复制命令-task.
发布
每个 environment/stage:
- 对 .config 使用 "Replace Tokens" 扩展名。这从发布定义中读取特定于环境的变量并替换 .config 中的标记(在构建中由 .config.token 替换)
- 进行部署
替换存档中的令牌需要不同的扩展,Tokenize in archive might be an option there. We use Colin's Build and Release tools, which has nifty tokenizator for json-files. I prefer Colin's tokenizer, as it's pretty straightforward and one doesn't have to dabble with XPATH and transformations. We also use Json to Variables 用于在 VC 中存储环境变量,而不是将它们存储在发布定义中。我怀疑最后一个在 TFS 2017 中不起作用,但还没有尝试过。
至于最初的问题,我怀疑您使用的扩展程序无法从存档中读取您尝试标记化的文件。我自己没有使用过该扩展,但我将 JSON 文件放入版本控制,因此它最终出现在构建工件中。目标文件名意味着扩展可以写出最终的配置文件,可能会替换原来的 app.config.