web.config XML-Document-Transform not working in VS 2013



To automate the web.config transformation for different environments whats the best concept to use ? I have below one as one of the option to do this. But are there any better options than this SDT ?


I tried to use XML-Document-Transform concept to generate the config files for the environments like Test,Staging and PROD. But the resultant web.config doesn't reflect the changes of Test/Staging/RPOD.


web.config xml:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="personalDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyDevReleaseDB;Integrated Security=True" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="lists.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>


And the below one is Web.PROD.config with xdt keywords which was showing in the active solution configuration in configuration manager.



<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://ift.tt/1fUQU29">
<connectionStrings>
<add name="personalDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleasePRODDB;Integrated Security=True"
xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>


What am I doing wrong here ?


No comments:

Post a Comment