Search code examples
connection-stringwebdeploy

WebDeploy - Connection String TFS2017


In my WebConfig I have the following connection String.

<connectionStrings>

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

</connectionStrings>

In my pub.pubxml file I am trying to transform this String with the Env variables from my Release definition for Username,password and Domain. Could I call this connection string from a parameters.xml file? I tried adding this to my Web.Release.Config file but it did not work xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> .


Solution

  • Make sure you are using a right format such as the name matches the auto generated connection string name in the parameters.xml. A sample:

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

    For more details, you could take a look at this blog: How to build a connection string from other parameters within MSDeploy packages to avoid repeating yourself in Release Management variables