Sunday, June 28, 2015

.NET web.config Style Transformations for app.config Files

Visual Studio 2010 added a useful feature that allowed a web.config file to be transformed during the build processes. This made it possible to have different settings for development, test, and production environments without having to manually edit web.config files after a project has been built. This feature would also be useful other types of .NET applications (i.e. applications that use app.config files), but unfortunately Microsoft does not current support transforming app.config files (as of Visual Studio 2013).

Fortunately Golan Avraham has created a Visual Studio extension, called Configuration Transform, that makes it easy to do web.config style transformations on app.config files. This extension can be downloaded from https://visualstudiogallery.msdn.microsoft.com/579d3a78-3bdd-497c-bc21-aa6e6abbc859. This extension works with Visual Studio 2010, 2012, and 2013.

The really nice thing about this extension is it works with TFS Build servers without having to install the extension on the TFS Build server itself. It only need to be installed on the machine where you plan to setup the transformation.

More information the web.config transformation syntax can be found at https://msdn.microsoft.com/en-us/library/dd465326.aspx.

No comments: