Click here to Skip to main content
15,941,444 members
Articles / All Topics

SlowCheetah for Configuration Transforms for Windows Apps

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
11 Feb 2016CPOL3 min read 6.2K   1  
SlowCheetah for Configuration Transforms for Windows Apps

UPDATE: The creator of SlowCheetah has announced that he will no longer be supporting SlowCheetah. His intent was for Microsoft to implement this solution into Visual Studio out of the box. Unfortunately, that has not yet happened. If you would like to continue to have this functionality in future version of Visual Studio, please vote for the feature here: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2043217-support-web-config-style-transforms-on-any-file-in.


I was talking with a co-worker a few days ago, and he mentioned that he was using build events and some x-copy to replace his app.config files when building his projects. I asked him why he wasn’t just using slow cheetah, and he looked at me like I was from Mars. Apparently, not everyone knows that there is a tool out there that makes app.config files as easy to transform as web.config files. Enter SlowCheetah. Just install this VSIX, and you’re ready to go.

I will go ahead and walk you through a simple implementation of SlowCheetah on a console application. The below assumes that you have already downloaded and installed the SlowCheetah VSIX from here.

Let’s assume that I have a new console application. By default, there will be two configurations in configuration manager: Debug and Release. Let’s assume that I want to add a third called ‘QA’.

Add a New Configuration

Open configuration manager by right clicking your solution in Solution Explorer and selecting ‘Configuration Manager’. In the Active Solution Configuration drop down list, select ‘New’. Name it QA, and make sure the ‘Create new project configurations’ check box is checked. Click OK.

1_Configuration Manger

Install SlowCheeta va NuGet

By accessing the NuGet Package manager, search for SlowCheetah and Install.

2_Nuget

Create an Application Setting in App.Config

Here, we will create an app setting that we can use to demonstrate the transform ability that SlowCheetah gives us.

3_AppConfig

Create a New Transform

By right clicking your app.config file, and selecting ‘Add Transform’. A new configuration file is created as a child you for your app.config. If you are familiar with the web.config transform ability of Visual Studio, this should look familiar to you.

4_Add Transform

**Note that App.QA.config has been created.

5_New Transforms

Add Configuration Value for QA.App.config

Now create an app setting in your new config file. This is the value that will be used during our transform.

6_QA Settings

Preview the New Transform

If you are using Visual Studio 2013, the ability to preview your transforms is built in. Just right click your transform file and select ‘Preview Transform’ and you will be able to see your transform changes. If you are using a version of Visual Studio prior to 2013, you will actually need to run the transform.

7_Preview

8_Preview Result

Deployment

If you are doing some sort of automatic deployment, you will need to take some extra steps to make sure that the transforms will run on your build servers. The creator of SlowCheetah has put together a good step by step on how to get that going here.

Conclusion

Configuration transforms are a powerful tool when it comes to developing applications for different environments. We have been able to do this in web applications easily for quite some time in Visual Studio; however, until SlowCheetah, there was no way to transform config files in Windows Apps.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --