Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

When my build action runs, the web.config transforms only partially work



  • In my root web.config, I have the following sections:

      <connectionStrings configSource="ConnectionStrings.config" />
    
      <appSettings configSource="AppSettings.config" />
    

    In our web.Debug.config we have these corresponding sections:

      <appSettings xdt:Transform="Replace" >
        <add key="SomeKey" value="SomeValue" />
      </appSettings>
    
      <connectionStrings xdt:Transform="Replace" >
        <add name="Connection"  connectionString="server=0.0.0.0; database=SomeDb; uid=SomeUser; pwd=XXXXXXXXX; Connection Timeout=300" providerName="System.Data.SqlClient" />
      </connectionStrings>
    

    When my build action "Build ASP.NET Web or MVC Project" runs using the Debug configuration and the transformed web.config has the following content:

      <appSettings>
        <add key="SomeKey" value="SomeValue" />
      </appSettings>
    
      <connectionStrings xdt:Transform="Replace" >
        <add name="Connection"
          connectionString="$(ReplacableToken_Connection-Web.config Connection String_0)"
          providerName="System.Data.SqlClient"/>
      </connectionStrings>
    

    As you can see the xlt transform works fine on the <appSettings>, but fails on the <connectionStrings>.

    I have confirmed that the web.config transforms do work correctly when published from Visual Studio.

    Any ideas?

    Product: BuildMaster
    Version: 4.0.9



  • Add this extra MSBuild parameter to the action:

    AutoParameterizationWebConfigConnectionStrings=False



  • Additionally, if you have publish profiles saved in your solution, you can add the following additional argument that will exhibit the same behavior as AutoParameterizationWebConfigConnectionStrings=false for the chosen ProfileName:

    /p:PublishProfile=ProfileName



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation