Comment Reflower for Visual Studio

Comment Reflower is an add-in for Microsoft Visual Studio that provides configurable automatic reformatting of block comments, including XML comments. The program was originally created by Ian Nowland for Visual Studio 2003 and 2005. These versions are still available at the official website.

Sadly, the last official update was posted in January 2006 because Ian Nowland has since changed platforms. The last official version of Comment Reflower is not compatible with Visual Studio 2008 or later, apparently due to changes in the extensibility architecture.

Terrified that I might now have to format my XML comments manually, I tinkered with the 2005 distribution until I got it to work with Visual Studio 2008 and 2010/2012. Note that this port is not only unofficial but also lacks the MSI setup package of previous versions, although there is a separate binary package for XCopy deployment. Both packages include a ReadMe file that describes the deployment and operation of the add-in.

Note — The Express editions of Visual Studio don’t support any plug-ins, so you need Standard edition or better to run Comment Reflower. And starting with Visual Studio 2015, Microsoft has deprecated add-ins entirely, so Comment Reflower won’t work on any edition.

VSIX for VS2012–15

Kristofel Munson has built a VSIX version of Comment Reflower that works with Visual Studio 2012/2013 and even 2015. You can download the VSIX binary at the Visual Studio Gallery. Source code is available at the CommentReflowerVSIX project on GitHub. Thanks to Legolas who pointed out this port!

Speaking of GitHub, Sebastian Schuberth had created an earlier independent CommentReflower project that includes both Ian Nowland’s original release history and my own updates, up to 2011. No further contributions were ever made to this project, but if you’re already working with GitHub you might find the source code useful as a basis for your own modifications.

Installer Caveat

Comment Reflower does not have an installer. If you intend to write one, please consider this: My quick & dirty port expects the user settings file, CommentReflowerSetup.xml, in the same folder as the add-in DLL files. This behavior is defined in method CommentReflower.Connect(), file Connect.cs. As a consequence, you cannot simply wrap an installer around the existing distribution and place the add-in DLL files under Program Files, as that would put the settings file in a global write-protected location. You must first change the Connect() method to put the settings file in some user-specific default location.

Binary Package

The current port of Comment Reflower for Visual Studio 2010 and 2012 is CommentReflower.zip (56.6 KB, ZIP archive). Just extract everything into one of the following directories, substituting your Windows user name for <User>, and restart Visual Studio:

  • \Documents and Settings\­<User>\­My Documents\­Visual Studio 2010\­AddIns (on Windows XP)
  • \Users\­<User>\­(My) Documents\­Visual Studio 2010\­AddIns (on Windows Vista and later)

Or extract the ZIP archive into a temporary directory of your choice, then study the enclosed ReadMe file before deciding how to proceed. You should also do this when using Visual Studio 2012 since you’ll have to adjust the add-in control file.

The March 2010 version for Visual Studio 2008 is still available as CommentReflower2008.zip (55.1 KB). The only difference from a user perspective is that you need to substitute 2008 for 2010 in the file paths shown above.

Important — Please be sure to read my note on automatic execution blocking! Visual Studio may refuse to load the add-in if you unpack the archive with Windows Explorer. That’s a Microsoft anti-feature, sorry.

Source Package

The Visual Studio 2010 source code from which the current binary package was created is CommentReflowerSource.zip (176 KB). Again, just extract everything into a directory of your choice, then refer to the enclosed ReadMe file for detailed information.

Release History

  • October 2012 – Added AddIn control file for Visual Studio 2012, as advised by Shane Tolmie.
  • November 2011 – Restored original version of file CommentReflower\­AssemblyInfo.cs.
  • July 2010 – Added note regarding empty Line Start field, as detected by David W Smith.
  • May 2010 – Corrected description of Visual Studio add-in locations, as advised by Martin Richter.
  • April 2010 – Recompiled and otherwise updated for Visual Studio 2010.
  • March 2010 – Fixed AlignParameters command. When the first parameter is preceded by one or more spaces or tabs, parameters on the following lines are now correctly aligned with the start of the first parameter, rather than with the first space character after the opening parenthesis. Bug report and fix were submitted by Arnt Witteveen.
  • January 2009 – Revised for XCopy deployment to the Visual Studio AddIns folder, as described above.
  • June 2008 – Original release for Visual Studio 2008.