Azure Devops(VSTS)发布管道变量

时间:2018-11-27 22:37:07

标签: azure-devops azure-pipelines azure-pipelines-release-pipeline

希望我能使它尽可能简单明了。我正在尝试根据环境替换我的web.config中的变量。目前,我可以通过将变量设置为“#{variablename}#”格式来替换其他变量,例如连接字符串和应用程序设置中的变量。不适用于端点地址中的变量。

我以前使用替换令牌来完成此操作,但是现在必须将其内置到Azure中,因为在执行替换的构建或发布任务中没有任何额外的任务。除非是我不知道的其他地方。我已经搜索了所有可以找到的内容,但没有看到为什么此部分中的值未被替换的原因,我以为是根据名称进行替换,但我看不到为什么该值不会被替换。

此替换项适用于VariableName ConnectionString

<connectionStrings>
    <add name="ConnectionString" connectionString="#{ConnectionString}#" providerName="System.Data.SqlClient"/>
  </connectionStrings>

这不适用于VariableName ServiceSoapEndPoint

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Service" />
      </basicHttpBinding>
      <customBinding>
        <binding name="Service1">
          <textMessageEncoding messageVersion="Soap1" />
          <httpTransport />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="#{ServiceSoapEndPoint}#" binding="basicHttpBinding"
        bindingConfigu`enter code here`ration="ServiceSoap" contract="Service.ServiceSoap"
        name="ServiceSoapEndPoint" />
    </client>

1 个答案:

答案 0 :(得分:0)

我无法找到所需的确切解决方案,所以我最终做了一些工作来完成此任务。我基本上是在尝试使用环境变量,以便在发布时会根据环境更改端点地址。由于我能够在appsettings元素中获取要更改的值,因此我使用从appsettings值读取的值来实例化soap服务。

相关问题