How to use applicationSettings in the new web.config configuration in VS2010? How to use applicationSettings in the new web.config configuration in VS2010? asp.net asp.net

How to use applicationSettings in the new web.config configuration in VS2010?


The best way would be to do the following:

<applicationSettings>   <NAMESPACE>    <setting name="Testenvironment" serializeAs="String"  xdt:Transform="Replace" xdt:Locator="Match(name)">     <value>True</value>    </setting>   </NAMESPACE> </applicationSettings> 

Rather than Zubeyir suggestion as this one will only replace the specifed setting rather than replacing the WHOLE of the applicationSettings section.


You could also use this way; for the prod environment for example.

<applicationSettings xdt:Transform="Replace">  <NAMESPACE>    <setting name="Testenvironment" serializeAs="String">     <value>False</value>    </setting>   </NAMESPACE> </applicationSettings> 

Regards.


You should copy this setting to both web config files - Web.Debug.config and Web.Release.config and put the transformation attributes xdt:Transform="SetAttributes" xdt:Locator="Match(name)".

You can see this video tutorial - http://chriskoenig.net/index.php/2010/04/08/how-do-i-web-config-transformations-in-vs2010/

Hope that helps.