WebDeploy - 连接字符串 TFS2017

WebDeploy - Connection String TFS2017

在我的 WebConfig 中,我有以下连接字符串。

<connectionStrings>

   <add name="Name" connectionString="Url=hSomeURL; Domain=SomeDomain; Username=UserName; Password=YYYYY;"

</connectionStrings>

在我的 pub.pubxml 文件中,我尝试使用我的用户名、密码和域的发布定义中的 Env 变量来转换此字符串。我可以从 parameters.xml 文件中调用此连接字符串吗?我尝试将其添加到我的 Web.Release.Config 文件中,但它不起作用 xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> .

确保您使用的格式正确,例如名称与 parameters.xml 中自动生成的连接字符串名称匹配。样本:

<parameters>
  <parameter name="Username" value="xxx">
    <parameterEntry type="XMLFile" scope="web.config$" match="//configuration/connectionStrings/site/@xxx"/>
  </parameter>

更多细节,你可以看看这个博客:How to build a connection string from other parameters within MSDeploy packages to avoid repeating yourself in Release Management variables