What i dislike about the Web.config Transformation in VS2010

There are a couple of things that i strongly dislike about the Web.config transformation in VS2010:

  • Only works with XML files (eg: Can’t be used to generate a release notes.txt file)
  • Does not seem to support externalized sections, eg: log4net.config in a separate file
  • No support to copy/paste transform files
  • Only works when Visual Studio 2010 is installed (And i am still not convinced a build server should have this).
  • Ties environment to build configuration

Lesson learned: Don’t trust your co-workers, always double-check!

  • Having multiple transformations is easy-peasy, just invoke the TransformXml task for all your config files and make sure your transformation files are correct. For log4net this would look like:
  • <log4net xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
     <root>
      <level value="ERROR" xdt:Transform="Replace"/>
     </root>
    </log4net>
    
  • The support for copy/paste can be achieved by removing the DependentUpon tag in your proj file (At the cost that you don’t have the + sign in solution explorer which ‘hides’ the transforms files)
  1. Can you provide an examples of using the TransformXml task on other config files? I’m new to MsBuild programming and can’t figure it out.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>