Azure devops 使用VSTS版本定义替换列表中的多个变量

Azure devops 使用VSTS版本定义替换列表中的多个变量,azure-devops,azure-pipelines-release-pipeline,Azure Devops,Azure Pipelines Release Pipeline,我目前正在VSTS中使用变量替换,但是我遇到了如何从列表中选择特定元素的障碍 我必须提供要替换的变量的名称和替换旧值的键。我可以使用选择配置中的嵌套元素 我有以下app.config <services> <service behaviorConfiguration="ServiceBehaviour" name="Application.Project01"> <endpoint address="" behaviorConfiguration="we

我目前正在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.baseaddress.add.baseaddress

我尝试了以下方法来编辑dns值

  • services.1.service.endpoint.identity.dns
  • services.1.service.endpoint.identity.dns.value
我正在使用的任务是Azure应用程序服务部署版本3。*

对于Azure应用程序服务部署任务的功能,它仅对配置文件的applicationSettings、appSettings、ConnectionString和configSections元素生效

所以你不能用它来达到你的要求

您可以尝试使用XML转换


您还可以尝试其他任务,例如或。

您用来替换的任务或脚本是什么?@starianchen MSFT对不起!我忘了添加,Azure应用程序服务部署。不过
system.serviceModel
不是配置部分吗?谢谢你的选择!我给他们打一针。您知道任务应该在Azure应用程序服务任务之前还是之后执行吗?如果这很重要,则工件是一个zip文件。system.serviceModel不是受支持的元素。对于其他令牌任务,它应该发生在Azure应用程序服务任务之前,并且您还需要在令牌任务之前提取zip文件。