Last post Mar 15, 2015 09:26 PM by Angie xu - MSFT
Mar 10, 2015 09:57 AM|friskyweasel|LINK
hello - We have several different environments for which we publish asp.net builds, and as the title states, the web.config transform process is, for some reason, adding in unwanted line breaks into our web config files. We would like for the transform to
insert/update the actual key/value pair different values, but to not perform any formatting / word wrap at all. Does anyone know how to accomplish this?
Example: If we right-click on one of the transformation web.config files in solution explorer (Web.Test.Config for example), and select "preview transform", we may see something like the following:
Main Web.Config file random value:
Transformed Web.Test.Config equivalent value:
The issue also happens when long lines of text in the main Web.Config file are transformed....it seems lines longer than 150 columns or so end up being automatically word-wrapped to multiple lines during the transform process. How can we prevent this automatic
Mar 10, 2015 11:29 PM|Angie xu - MSFT|LINK
Welcome to asp.net forum.
How can we prevent this automatic formatting behavior?
According to your description above, I wonder why you want to prevent this automatically word-wrapped behavior, it makes your web.config file neat.
Mar 11, 2015 09:43 AM|friskyweasel|LINK
Hello Angie and thanks for your reply. You are absolutely correct that it is an "out of the ordinary" request. The simplest way I can put it is that it's just a personal preference for us for this one particular application. We do a very high amount of web.config
comparison using compare tools (winmerge), and as you know for each "difference" it finds, it paints a yellow bar across that area of the screen. Say we have 2 scenarios:
Scenario #1) A certain entry in our web.config remains long without line breaks (even though this goes against standard coding/formatting best practices):
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true"/>
Scenario #2) The same entry, with more popularly accepted formatting with line breaks:
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false"
authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
When using winmerge against these two entries, the first entry would generate at most "1 line" with a difference. However, if we modify the values in the key/value pairs between environments, the 2nd entry may show anywhere from 1 to 5 lines marked as having
differences. In our particular case, all we really wish to be able to do is glance at the winmerge result and see that we have a difference in our "httpsTransport" entry....we don't need to necessarily see every little difference of every key/value pair stored
under "httpsTransport". This makes for much "cleaner" winmerge sessions, and allows us to narrow down general file synchronization problems faster and with less clutter. Hopefully this makes some sense.
I realize it's unorthodox...I just thought I'd throw the question out there. It seemed to me that there would have been some option contained in the publish profile settings to either enable or disable automatic formatting during the transform process, but
maybe there is not.
One other thing....if it turns out that disabling this automatic formatting is not possible, do you know what steps we could take in the IDE that would allow us to apply this exact same formatting (the same formatting that is applied when doing a transform)
to all of our source web.config documents (ie, web.config, web.test.config, web.prod.config, etc....)? I realize that this would violate our above stated goal of reducing the # of winmerge line differences found, but if forced to choose I think we would prefer
that our web.configs stay in the exact same format/structure throughout the entire development life cycle, from development all the way to production (including post-transform versions).
Thanks for any help you can provide.
Mar 15, 2015 09:26 PM|Angie xu - MSFT|LINK
Thanks for your feedback.
As I know, Visual Studio set word-wrapped behavior automatically by design. For this specific scenario, if this feature is important to you, you could submit this feature request:
http://visualstudio.uservoice.com/forums/121579-visual-studio The Visual Studio product team will give positive response about this. Thanks for your understanding.