If you run unit tests in your project, then it's very likely that you'll have one or more settings that will need to change depending on which environment you're using, e.g. the build server might need to use a different setting than your local PC. Out of the box, when we work with web projects, app.configs aren't automatically transformed.
To manually tell MsBuild to transform a file you'll need to use 'Microsoft.Web.Publishing.Tasks.dll'. 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, but, for whatever reason, it sometimes doesn't seem to transform my app.config 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:
Next, open up your projects '.csproj'. At the bottom of the file add the bottom four lines:
One thing that you may need to change is the version number of the SlowCheetah package that you use 2.5.48 is the latest of writing but things change.
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, but, you might want to consider using that.
If you add the script above and you have a '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, enjoy!