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.
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.
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.
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).
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With