Web.Config Transformations - Visual Studio 2010

Overview

To facilitate the dependency of configuration settings to environment, Visual Studio 2010 introduced what is called web.config transformations. This articles describes how to use them.

Walk-Through



<appSettings>
  <add key="EmailServer" value="MyMailServer"
      xdt:Transform="SetAttributes" xdt:Locator="Match(key)"
        />
</appSettings>


<connectionStrings>
    <add
      name="Same-Name-As-Web.Config-File"
      xdt:Transform="SetAttributes"
      xdt:Locator="Match(name)"
      connectionString="New-Connection-String"
      providerName="System.Data.SqlClient"
   />
</connectionStrings>