azure-devops - 使用 VSTS 发布定义替换列表中的多个变量
问题描述
我目前在 VSTS 中使用变量替换,但是我遇到了如何从列表中选择特定元素的障碍。
我必须同时提供要替换的变量的名称和替换旧值的键。我可以用来.
在配置中选择嵌套元素。
我有以下 app.config。
<services>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project01">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface01">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project01/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project02">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface02">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project02/" />
</baseAddresses>
</host>
</service>
</services>
我希望能够单独替换这些服务中的每一项中的变量。我感兴趣的特定键是services.service.endpoint.identity.dns.value
和services.host.baseaddresses.add.baseaddress
。
我尝试了以下方法来编辑 dns 值
services.1.service.endpoint.identity.dns
services.1.service.endpoint.identity.dns.value
我正在使用的任务是 Azure App Service Deploy 版本 3。*
解决方案
对于Azure App Service Deploy 任务的XML 变量替换功能,它仅对配置文件的 applicationSettings、appSettings、connectionStrings 和 configSections 元素生效。
所以你不能用它来达到你的要求。
您可以尝试使用 XML 转换。
您也可以尝试使用其他任务,例如发布管理实用程序任务或其他。
推荐阅读
- java - 如何捕捉在 Alfresco 的 Activiti 6 中发送电子邮件时发生的错误?
- flutter - 如何在颤动中更改选中和未选中状态的选项卡图标的颜色?
- python - 在我的模型中使用 Pytorch SSIM 损失函数
- javascript - 数据库到 Highchart ASP.NET MVC
- codenameone - MapContainer 仅在点击/触摸时显示
- javascript - 图像在网站的放大预览中不可见
- html - 用户参数不使用boostrap多选下拉菜单将数据作为rails中的数组
- reactjs - 我如何获取类型以及 prop-types 包中是否需要该道具?
- javascript - 如何处理函数文档
- ios - 运行时 ivars 和关联对象的内存