Wednesday, August 24, 2011

SlowCheetah! finally transformations come to app.config files

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.

SlowCheetah changes that. SlowCheetah, allows you to setup multiple config files for the different configurations that you have for your app.config files. Sweet!

Right click on your App.config file and you get the “Add Transform” option.

image

Selecting Add Transform adds multiple config files (one for each build configuration)

image

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
image
App.Debug.Config
image
Leads to this (when you hit F5)  
image

One of the coolest features is the fact that you can preview the transformation without having to run a build:

image (very, very cool).

Now, what I need to figure out is how to get the transformations to occur during a TFS build.

2 comments:

Sayed Ibrahim Hashimi said...

Hi, all the functionality is captured in an MSBuild target and a task. To automate this in your build process follow these steps:
1. Copy the files from C:\Users\{YOUR-USERNAME}\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1 into version control
2. When building the project set the property SlowCheetahTargets with the path to the SlowCheetah.Transforms.targets

Or you can install this plugin on your build server. If you have any issues let me know by emailing me at sayedha(at)[Microsoft]{dotCom}.

It would be really awesome if you wrote a blog post about how to do it for others if you get it working.

Cavanman said...

Hi Raj,

Great plugin - well done.

I have implemented it in a windows service that has a windows installer which builds the release package. Any idea how I get the transformation to run when I build an installer package???

Thanks,

Mike
Dublin, Ireland