Skip to content

Instantly share code, notes, and snippets.

@hanssens
Created March 21, 2011 07:50
Show Gist options
  • Save hanssens/879158 to your computer and use it in GitHub Desktop.
Save hanssens/879158 to your computer and use it in GitHub Desktop.
Web.config Transformations
/* Original */
<appSettings>
<add key="MyUsername" value="hello-user"/>
<add key="MyPassword" value="yadayadayada"/>
</appSettings>
/* Overload */
<appSettings>
<add key="MyPassword" value="xxx......" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
/*
* Final
*/
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<applicationSettings>
<MyApplication.DemoApp.Settings>
<setting name="MyUsername" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
<value>hello-world</value>
</setting>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment