Introduction
Here I come with an article to help my developer community. This article is about transforming your app.config/web.config settings based on the configuration environment selected using package Slow cheetah. I have also created a demo project to demonstrate how this works. Hope you find it interesting!
Background
This article is a reference.
Step by step process
Step 1: Install the package "Slow Cheetah" into your solution.

Step 2: Right click on the App.config and select the option Add Transform.

The Add Transform will add the available configuration environment app.config (like for Test the config file will be added as App.Test,Config) files under the "App.config"

Step 3: To tweak the appsetting values ,connection strings etc based on the configuration environement. Here I am tweaking the webServiceUrl value based on environment.
This is the default value in the App.config.
- <add key="webServiceURL" value="https://dev.com"/>
- <add key="webServiceURL" value="http://test.com" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
Add Configuration Environment
Here, I am just focusing on adding the configuration for a new environment. By following the below steps you can configure the environment.
Step 1: Select the configuration manager from the drop down as shown below. The configuration Manager window pops up.

Step 2: Select the option <New> from the drop down "Active Solution Configuration" to add a new environment configuration.

Step 3: Enter the environment name for which you want to add the configuration and click on OK. So here I am adding the Perf environment configuration.
That's All you have added the configuration for the environment. Now you can check whether the newly added environment is added in the list or not.

Example
To demonstrate this I have created a console application which will transform config using slow cheetah. I have followed the above steps and added the three Configuration environments "Perf","Test" and "UAT". And based on the configuration environment selected in my demo the url value gets changed.

Points of Interest
You can also preview the transformation by right clicking on the particular config file and then select the option "Preview Transform".
Like here I want to preview my test config.

So this is how the transformed config looks now.


George HendricksonPosted Jun 6, 2019, 12:48 PM
I'm having a problem with this. I created a windows service that uses application settings in the app.config file. I have my transformed config files and everything transforms as it should but when reading the settings from any build configuration, the default values from the app.config file are read even though the app.config file with the values from the build configuration are in there. Its getting the values from someplace else and i can't figure out where. Any ideas?
Rajan MPosted May 9, 2019, 3:31 AM
Do we need to add SlowCheetah in project level or solution level? When I added in project level, I don't see any Transform Config menu option when highlighting the app.config. Also,please mention which Visual Studio version you used for this article. Thanks.
Акмаль СалиховPosted Jun 20, 2018, 9:55 AM
I want to get proper connectionstring from proper app.config (App.Debug.config in my case) file when I run Update-Database command in Package-Manager-Console. What should I do to achieve it? Now ef command takes connection string from main app.config ignoring App.Debug.config. p.s. I run it under Demo configuration...
mohan sanakaPosted May 18, 2016, 2:48 AM
very good artical
Neeraj KumarPosted May 17, 2016, 2:53 PM
Nice
Kuppurasu NagarajPosted May 17, 2016, 10:56 AM
Nice sharing..
Debasis SahaPosted May 17, 2016, 9:48 AM
Nice one..
Bhuvanesh MohankumarPosted May 17, 2016, 5:45 AM
Good one
Rajeev PunhaniPosted May 17, 2016, 4:23 AM
Nice Article.