In this tutorial, you will learn about on-prem Ci/Cd pipeline considerations around config transformations. If you work using multiple different environments, it is very likely that you will have one or more settings that you will need to change depending on which environment you are using. The build server might need to use different settings compared to that of your local PC

🖥️🖥️🖥️

When we work with .NET projects, app.config and web.config files are not automatically transformed and updated magically to work with different environments. You will need to manually tell MsBuild to transform a file somewhere. In the background, Visual Studio uses code found within Microsoft.Web.Publishing.Tasks.dll to do this. This is where things get interesting...

Microsoft.Web.Publishing.Tasks.dll only gets installed with Visual Studio. Installing Visual Studio on the build server and paying for a yearly license seems overkill to get access to one assembly, this is where SlowCheeta comes in. Over the years I've found SlowCheeta works on my local PC brilliantly, however, for whatever reason, it sometimes doesn't seem to transform my app.config files magically on the build server. There is a workaround for this, which I'll outline below.

First, make sure you install SlowCheetha into your project using Nuget:

How To Transform Your App.configs With SlowCheeta And MsBuild 1

Next, open up your projects .csproj. At the bottom of the file, add the bottom four lines of code:

One thing that you may need to change here is the version number of the SlowCheetah package that you install. As of writing, 2.5.48 is the latest version, however, this will change. Do not simply copy and paste the code above without updating it ⚠️

It is also worth noting that in the image above there is a newer Micosoft.VisualStudio.SlowCheetah package as well. I haven't used this yet as the old one works, however, you might want to consider using that instead. After adding the configuration above, if you have an app.release.config, when you build your project in release mode, as long as the transforms have been set up correctly your app.config should automatically get updated with the latest values. Happy Coding 🤘