Search code examples
asp.netasp.net-mvcweb.config-transform

Removing comments from web.config on build


Is it possible to remove the commented lines from a web.config on build? xml transform is fine to remove some elements but I couldn't find any syntax to clean the comments from the file.

We are using TFS 2010 build server for our builds.


Solution

  • UPDATE: See actual and working answer below.


    It's not possible to do with xml transformation.

    But you can do it with your own console app or msbuild task. See example code here Remove XML comments using Visual Studio 2010 Web Config Transformation