Web.config, version control and nice formatting

EPiServer has a site tag with a lot of attributes. When you change the web.config from EPiServer Manager or by calling Save on the Configuration class yourself all attributes will be on one looong line (this is default behaivour by the dotnet framework so its not EPiServers fault).

If you put web.config under version control and would prefer if changes to singe attributes are easy to detect with a diff tool, this is not the optimal.

It is possible to change formatting in Visual Studio to get one attribute per line and that works much better for text diff tools. (This requires that you do your changes with Notepad or Visual Studio and not use EPiServer Manager or the Admin Mode to change the settings.)

Go to Tools -> Options -> Text Editor -> XML -> Formatting and select “Align attributes each on a separate line”

Click Edit -> Advanced -> Format Document (or Format Selection if you only want to adjust a part of the file) before you check in your web.config to reformat.

Voilà! Your web.config is readable!

(See also discussion in EPiServer Developer Forum)