Visual Studio has had since VS2010 (or maybe it was VS2008) a way to setup multiple configuration files for different types of build configurations. But unfortunately, this ability was provided on to web projects (web.config files) and was not available for app.config files.
Right click on your App.config file and you get the “Add Transform” option.
Selecting Add Transform adds multiple config files (one for each build configuration)
The transformation syntax is exactly the same as the one used for Web Application Project Deployment. For more info read: http://msdn.microsoft.com/en-us/library/dd465326(VS.100).aspx
Here is an example:
|Original App.config ||App.Debug.Config |
|Leads to this (when you hit F5)|
One of the coolest features is the fact that you can preview the transformation without having to run a build:
(very, very cool).
Now, what I need to figure out is how to get the transformations to occur during a TFS build.