In Visual Studio 2010 we introduced a simple and straight forward method of transforming web.config during publishing/packaging. This support is called XML Document Transform, aka XDT. It allows you to transform any XML file, not just web.config. To learn more about XDT check out the docs.
Since we’ve released XDT there has been interest in re-using the transformation engine in other scenarios. To enable some of those scenarios we released XDT on NuGet. After that we started working on integrating XDT into NuGet and asked for some feedback from the community.
In order to cover all the scenarios for NuGet users we decided to release the source of XDT on codeplex.com using an Apache 2.0 license. You can now redistribute XDT with your own applications.
There are a few community projects which are already using XDT. Below you can see a few examples.
SlowCheetah
SlowCheetah is an open source Visual Studio 2010/2012 extension which enables you to transform app.config, as well as any other XML file, during build based on the build configuration.
SlowCheetah.Xdt
SlowCheetah.Xdt (project page) contains an MSBuild task, TransformXml, which allows you to invoke XDT transforms during a build.
This library also contains a custom XDT transform, AttributeRegexReplace. If you are interested in creating your own custom transforms read Sayed’s blog post – Extending XML (web.config) Transformations.
Web Config Transform Runner
Web Config Transform Runner is a command line utility for XDT. It is available through NuGet. You can read more about Web Config Transform Runner at Eric Hexter’s blog.
Config Transformation Tool
Config Transformation Tool is a command line tool to invoke XDT. Using this tool you can execute transforms from any command prompt, and also automate transforms in scripts.
If you create a project using XDT we’d love to hear from you in the comments section below.
Sayed Ibrahim Hashimi | http://msbuildbook.com | @SayedIHashimi
0 comments