I'm using SlowCheetah for XML transforming a bunch of config files in a project.
However, this same solution is part of a load balanced setup, where some config values differ between the different servers (two, in this case).
I have the following build configs
- Debug
- Release
- Release.Test
- Release.Prod1
- Release.Prod2
Almost everything in Release.Prod1 and Release.Prod2 is identical, except for some values in one of the config files. Is there any way I can have a file like Something.Release.Prod.Config
to be used on both of these build configs instead of having two identical files (Something.Release.Prod1.Config
and Something.Release.Prod2.Config
)?
...and to elaborate: In this case I am deploying to two environments, so one duplicated file is not really a huge crisis. What if you have ten or a hundred servers? I see no reason why a setup with a CI-server (Specifically TeamCity in this case) should not be able to do this, even though I suppose more customized setups are common in such environments.
How is this usually handled?
I suppose I can do some magic copying of files back and forth as a build step before the actual transformation happens, but this seems like a messy and overly complicated solution.
The configuration transformations are handled by the $(Configuration) variable in the TransformsFiles.targets file.
Here, you can change $(Configuration) to be any other value, like "Environment". Then just set the "Environment" variable in your MSBuild args -
This should allow you to keep your build settings and do your transforms independently.