Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web.Config formatting #233

Closed
Germs2004 opened this issue Sep 23, 2013 · 3 comments
Closed

Web.Config formatting #233

Germs2004 opened this issue Sep 23, 2013 · 3 comments

Comments

@Germs2004
Copy link

Every time I update using NuGet, my web.config gets ugly. I'd like it to not change my web.config if it already contains the right information, but in a different format.

It changes this (three nice lines):


to this (1 ugly line):


EDIT:
For some reason, my code isn't showing up when I post it. Below, I replaced the brackets with parenthesis so it will show up:

It changes this (three nice lines):
(add namespace="MvcSiteMapProvider.Web.Html" /)
(add namespace="MvcSiteMapProvider.Web.Html.Models" /)
(/namespaces)

to this (1 ugly line):
(add namespace="MvcSiteMapProvider.Web.Html" /)(add namespace="MvcSiteMapProvider.Web.Html.Models" /)(/namespaces)

@Germs2004
Copy link
Author

When I updated from 4.4.0.0 to 4.4.1.0, it did not mess up the namespace portion of my web.config (thank you!). Although, it did change the file's first line from:

to:

@NightOwl888
Copy link
Collaborator

Well, this is an all or nothing proposition. It was really NuGet's web.config transformation code that was doing this. We are now loading the web.config into an xmlDocument, making changes, and then saving with indentation enabled.

This really isn't the best solution either, as it will likely reset formatting of the entire file back to the "regular" indentation, so anyone's custom formatting will disappear everywhere in the file (not just in the part we edit).

This is just one of the many problems that we have to deal with when using NuGet that there is no right answer for.

@NightOwl888
Copy link
Collaborator

The encoding thing turned out to be a bigger problem than I first thought, so a fix for that has been added in v4.4.2. The file is now saved with the original encoding that was specified in the xml header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants