Convert web.config: add an XML comment to indicate which configuration was used

Using the web.config transformations, I want to make sure and include a comment at the top of the resulting web.config to indicate which transform file (configuration) was used to create it.

I see no way to include comments from conversion files, can this be done?

EDIT:

It seems that all comments in the conversion files are stripped.

+7
source share
1 answer

The following does not directly answer how to add or save comments, but may help you understand which conversion was used. Admittedly, this is a bit strange, so keep your eyes open for other answers. This is only the first thing that came to mind.

I don’t know how to save comments from conversions, but you can always insert a dummy application parameter for information delivery. An application should not actually use it for anything = p

Here I insert it with a transformation, assuming it is not in the main web.config. You can just as easily replace.

<appSettings> <add key="WhichTransformWasUsed" value="Production" xdt:Transform="Insert"/> </appSettings> 
+4
source

All Articles