Automatically transform app.config or any other config during build process. Once the transformation is set, it will run on other build machines without the extension.
Microsoft has a neat out of the box solution for Web Application Projects configuration transform which gives you the ability to have multiple configurations for each build environment (i.e. web.config). Somehow this ability is not included in other project types.
When you have multiple projects with many configurations the dev->staging->production task becomes very unpleasant. I remember back then having one app.config file with different commented configurations for each environment struggling to comment uncomment the right ones. Well I'm happy those days are over. After using app.config transformations for two years doing it the hard way by editing the project file and adding the configuration files manually, I thought it would be nice to write extension to automate this task.
There are many articles and solutions out there, some of them used as the inspiration for this extension.
When I developed this extension I had a few things in mind:
Multiple configuration files for different environments (e.g. dev/staging/production).
ClickOnce support.
Self-contained solution - no need to install the extension on all dev/ build server machines.
<?xml version="1.0"?>
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="Environment" value="Debug" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
Build project.
Linked Configs Step by Step Instructions:
Add link(Existing Item...) App.config file to project
Right click link App.config file in solution explorer and select Add Config Transforms
Click Yes button, if you select No button concrete(not linked) config files will be created which suits certain use case
Notice that you have new App.$$$.config files under App.config