Removing comments from web.config on build

asp.net, asp.net-mvc, web.config-transform

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

Problem

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.

Original source

Related problems