title: asp.net web.config transform not working
body: <p>I've made several configurations inside a project for different environments, one is debug and another is release</p>
  
  <p>Web.config:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;connectionStrings&gt;
      &lt;add name="InvitationEntity" connectionString="metadata=res://*/Models.InvitationSystem.csdl|res://*/Models.InvitationSystem.ssdl|res://*/Models.InvitationSystem.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=192.168.7.131;initial catalog=Invitation_Debug;persist security info=True;user id=invitation;password=debugMe;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
    &lt;/connectionStrings&gt;
    &lt;appSettings&gt;
      &lt;add key="FilePath" value="D:\temp"/&gt;
      &lt;add key="debugMode" value="Y"/&gt;
    &lt;/appSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Web.debug.config:</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
      &lt;!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --&gt;
  
      &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
        &lt;!--
          In the example below, the "SetAttributes" transform will change the value of 
          "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
          finds an attribute "name" that has a value of "MyDB".
  
          &lt;connectionStrings&gt;
            &lt;add name="MyDB" 
              connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
              xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/&gt;
          &lt;/connectionStrings&gt;
        --&gt;
        &lt;system.web&gt;
          &lt;!--
            In the example below, the "Replace" transform will replace the entire 
            &lt;customErrors&gt; section of your web.config file.
            Note that because there is only one customErrors section under the 
            &lt;system.web&gt; node, there is no need to use the "xdt:Locator" attribute.
  
            &lt;customErrors defaultRedirect="GenericError.htm"
              mode="RemoteOnly" xdt:Transform="Replace"&gt;
              &lt;error statusCode="500" redirect="InternalError.htm"/&gt;
            &lt;/customErrors&gt;
          --&gt;
        &lt;/system.web&gt;
    &lt;connectionStrings xdt:Transform="Replace"&gt;
          &lt;add name="InvitationEntity" connectionString="metadata=res://*/Models.InvitationSystem.csdl|res://*/Models.InvitationSystem.ssdl|res://*/Models.InvitationSystem.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=192.168.7.131;initial catalog=Invitation_Debug;persist security info=True;user id=invitation;password=debugMe;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
        &lt;/connectionStrings&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>Web.live.config:</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
      &lt;!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --&gt;
  
      &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
        &lt;!--
          In the example below, the "SetAttributes" transform will change the value of 
          "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
          finds an attribute "name" that has a value of "MyDB".
  
          &lt;connectionStrings&gt;
            &lt;add name="MyDB" 
              connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
              xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/&gt;
          &lt;/connectionStrings&gt;
        --&gt;
        &lt;system.web&gt;
          &lt;!--
            In the example below, the "Replace" transform will replace the entire 
            &lt;customErrors&gt; section of your web.config file.
            Note that because there is only one customErrors section under the 
            &lt;system.web&gt; node, there is no need to use the "xdt:Locator" attribute.
  
            &lt;customErrors defaultRedirect="GenericError.htm"
              mode="RemoteOnly" xdt:Transform="Replace"&gt;
              &lt;error statusCode="500" redirect="InternalError.htm"/&gt;
            &lt;/customErrors&gt;
          --&gt;
        &lt;/system.web&gt;
    &lt;connectionStrings xdt:Transform="Replace"&gt;
          &lt;add name="InvitationEntity" connectionString="metadata=res://*/Models.InvitationSystem.csdl|res://*/Models.InvitationSystem.ssdl|res://*/Models.InvitationSystem.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=192.168.7.133;initial catalog=Invitation_Debug;persist security info=True;user id=invitation;password=Invi#2014;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt;
        &lt;/connectionStrings&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>Here's the problem:</p>
  
  <p>Whenever I use debug or release config, the connection string is still the one in web.config instead of that in web.release.config</p>
  
  <p>Is there anything that I did wrong?</p>