I have never used transformations before. I a trying to use two different connection strings with my ASP.NET MVC 5 project.
Here is a summary of my Web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- more -->
<connectionStrings>
<add name="ChopsticksDBContext" providerName="System.Data.SqlClient" connectionString="Data Source=tcp:s10.winhost.com;Initial Catalog=DB_XXX31_kieXXX;User ID=DB_XXX31_kieXXX_user;Password=XXXX;Integrated Security=False;" />
</connectionStrings>
</configuration>
And I added the following tags into my Web.Debug.config file:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!-- more -->
<connectionStrings>
<add name="ChopsticksDBContext"
providerName="System.Data.SqlClient"
connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-KiewicWebsite-20131214161254;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-KiewicWebsite-20131214161254.mdf"
xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</connectionStrings>
</configuration>
I am running my porject in Debug mode and I am still getting the original value for the connection string.
Any idea what could be wrong?
The problem is that transformations are not applied when running your application in Debug mode. Transformations are only applied when you do a Publish of your website. You can verify this by doing a Publish using the Debug configuration. The published site will have the transformation applied, which in your case means that the connection string has been replaced.