XMLMassUpdate - how to keep environment in place with MSBuild

Posted by Marcus Hammarberg on November 17, 2008

Another great finding in MSBuild for me recently is the use of the XMLMassUpdate task of MSBuild Community Tasks.

For quite some time now I have always kept a separate .config-file for each environment. Even though I always has gone "hmm... but wait a while here... 90% of this file hasn't changed from the last environment...".

But you don't get the time to investigate always. But now, again after some thoughtful input by colleagues, I noticed the XMLMassUpdate.

With it you can easily keep a file with the changes for each environment and then let your build script generate the right version for the environment the script is building. This means that you only need to keep the differences (deltas I think it's called in formal speak) of the different files. Great!

Here is an great article describing how to use the XMLMassUpdate-task.

I bet you can use this task to generate some code also if you want to... Just imagine to generate a project-file that includes some autogenerated classes, that compiles into... Brrr could be ugly or hard to handle. Not for me... Now.

Published by Marcus Hammarberg on Last updated