I'm working with a large solution primarily consisting of projects targeting .NET Framework 4.x. A number of the projects in the solution make use of Settings.settings files. When adding new settings or changing values using Visual Studio's default editor for .settings files, the changes are reflected in the app.config file for the relevant project.
The config sections auto-generated at this point are formatted with multiple attributes per line, up to some line length limit at which point the attributes wrap onto a new line. For example we might see something like:
<setting name="SomeBackgroundTaskIntervalSeconds" serializeAs="String">
<value>60</value>
</setting>
However, at the same time we also have the settings in Visual Studio Tools -> Options -> Text Editor -> XML -> Formatting. We have the "Attributes" option set to "Align attributes each on a separate line" as is our preference for XML formatting as a development team, and we share a .vssettings file around the team and with new developers to make sure we're all on the same page. This means that if someone is making changes to a .config file and does "Format document", the aforementioned config section gets updated to:
<setting name="SomeBackgroundTaskIntervalSeconds"
serializeAs="String">
<value>60</value>
</setting>
These settings are completely ignored by Visual Studio when generating config sections from settings.settings files. As a result of this we quite often end up with Git diffs which have hundreds of line "changes" which are simply a new line having been changed to a space, or vice versa. This is of course a complete pain especially when trying to resolve merge conflicts in such files.
Does anyone know if there is any way to make Visual Studio generate config sections which respect Visual Studio's own settings with regards to XML formatting?
We could change the XML formatting setting mentioned above across the team, but it would seem a shame to need to resort to this to avoid what appears to be a VS inconsistency.