Posted on Tuesday December 7, 2010

Visual Studio 2010 plugin and tools

This is nothing more than a list of plugins and tools that I use with Visual Studio, so I can remember where to get them each time I flatten Windows. Most of these work with 2005 also.

  • Ghostdoc - autodocuments for you.
  • Sourceoutliner - your current class’ members ala the classview.
  • Powercommands - lots of new context menu options
  • Coderush - free version with some useful extra refactor tools
  • Pex - automates creating unit tests, sort of
  • Snipper - the tool I wrote for editing snippets
  • Slashdocs - extracts XML comments into a separate file from the source.
  • JSLint compiler - runs all .js files in your project through JSLint during compilation.

And the others below are fairly standard tools:

A decent tool for merges in Visual Studio 2008/2010

For diffing and merging, by far the best tool in my view is DiffMerge, a free tool by SourceGear. You can configure it to work with Visual Studio by going to Tools:Options:Source Control:VSTFS:Configure User tools.

From there, add these options for merge:

  • Extension: .*
  • Operation: Merge
  • Command: C:\Program Files\SourceGear\DiffMerge\DiffMerge.exe
  • Argument: /m /r=%4 /t1=%7 /t2=%9 /t3=%6 /c=%9 %2 %3 %1

and these options for compare:

  • Extension: .*
  • Operation: Compare
  • Command: C:\Program Files\SourceGear\DiffMerge\DiffMerge.exe
  • Argument: /t1=%6 /t2=%7 %1 %2

Snippets

Here’s a few snippets I use a lot, in zipped format. Stick them in your C:\Users\USERNAME\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippetsfolder

Snippets.zip

  • aa: Assert.AreEqual(o,o);
  • cr: Console.Readline()
  • docctor: creates a constructor with MSDN format documentation. Made slightly redundant by Ghostdoc.
  • doceq: creates Equals, ToString, GetHashCode with MSDN format documentation.
  • eqsummary: creates Equals summary XML documentation in MSDN format.
  • docevent: creates an Event and the raising method with MSDN format documentation.
  • docgethashcode: MSDN format documentation for GetHashCode()
  • doctostring: MSDN format documentation for ToString()
  • propgg: getter property with a backing field
  • propgs: getter/setter property with a backing field
  • linq: this one is a bit stupid. I often forget the syntax of lambda select statements (I prefer fluent) so this spits out the format.
  • newv: creates MyObject obj = new MyObject() where you enter the type and variable name.
  • nullcheck: throws an ArgumentException if an argument is null
  • snull: string.IsNullOrEmpty() snippet
  • snullex: throws an ArgumentException if a string argument is null
  • t3: sticks 3 lines of comments which I sometimes use when I have to write large sections of code in 1 method, and want to delimit them without regions. This was inspired by some C source some time ago but I should probably change this to /* and */

And a dependency project snippet for Silverlight, which saves many hours of typing.

For Eclipse and Java/Android developer, here is a settings file that takes the standard Visual Studio 2010 code color scheme for your text editor, and also binds F5/F6 to debug/compile.