Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding comments using XDT-Transform

I am using XDT-Transform in Visual Studio 2010 to generate multiple config files.

Xml transformation is working fine. But I cannot seem to find way to carry comments from an xml transform file to final file.

Just like there is Insert transform for adding config settings, is there anyway to add comments? Without comments I may have to give up on the whole transform approach.

like image 443
user1990594 Avatar asked Jan 18 '13 13:01

user1990594


People also ask

What is Xdt transform in web config?

The xdt:Transform="RemoveAttributes(debug)" attribute specifies that you want the debug attribute to be removed from the system. web/compilation element in the deployed Web. config file. This will be done every time you deploy a Release build.

How does web config transform work?

Switching configuration based on configuration is a perfect use of transformations. Web. config transformations are implemented using a markup language called XML Document Transform - XDT for short. XDT is an XML-based document format invented by Microsoft and used to describe changes to a Web.

How do I create a Web config transform?

If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).

What is Slow Cheetah C#?

This package allows you to automatically transform your app. config (or any file) when you press F5 in Visual Studio. You can have different transformations based on the build configuration. This will enable you to easily have different app settings, connection strings, etc for Debug versus Release.


1 Answers

This isn't exactly what you want, but I find it useful once in a while. XmlTransform will add comments if they are contained in an added element.

e.g.

<appSettings>
<remove key="comment" value="" xdt:Transform="Insert"><!-- this comment will appear in the transformed config file! --></remove>
</appSettings>
like image 131
and... break Avatar answered Oct 15 '22 12:10

and... break