Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 869
Burcephal Avatar asked Feb 06 '14 01:02

Burcephal


2 Answers

<add xdt:Transform="RemoveAll" xdt:Locator="XPath(//comment())" />

Put this node within the root node of your transform file. "XPath(//comment())" selects all XML comment nodes to delete.

like image 190
Peter Avatar answered Oct 15 '22 04:10

Peter


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

like image 41
Anri Avatar answered Oct 15 '22 03:10

Anri