Search code examples
visual-studiotfsmsbuildrelease-managementms-release-management

Release Management for Visual Studio - Remove Web.Config Key


What's the recommended way of removing a key from web.config during the build process for Release Management for Visual Studio 2013?

Using web.config transform, or adding a token for the entire line in the web.config (rather than using token for a value)?

Web.config Transform:

  <connectionStrings>
    <add name="myConnectionString" connectionString=""
      xdt:Transform="Remove" xdt:Locator="Match(name)"/>
  </connectionStrings>

Token Replacement:

__myConnectionString__

Solution

  • You should use a transform for things that you want to happen at build time. Like removing any bits that you only use in development.

    I usually have hard coded local values and then replace them with the release management keys during the transform. Then RM can own the rest.