Wednesday 27 October 2010

Visual Studio auto formatting of XML attributes

Visual Studio 2010 > Tools > Options > Text Editor > XML > Formatting > Attributes > Select 'Align attributes each on a separate line'.

After this is selected it will be possible to use the visual studio chord sequence: 'ctrl k' + 'ctrl d'.

This will auto format the attributes in an XML file so that each attribute has a new line. I find XML files easier to read when formatted like this. It is also easier to visually compare 2 XML files that have this formatting. (e.g. using ExamDiff)