Microsoft StyleCop

I just found out about a C# source code analysis tool from Microsoft called StyleCop.  You can download it from code.microsoft.com.

The tool’s description is as follows:

StyleCop analyzes C# source code to enforce a set of style and consistency rules. It can be run from inside of Visual Studio or integrated into an MSBuild project.

For all the details on the tool, check out the team’s blog that wrote it at http://blogs.msdn.com/sourceanalysis/.

Smart Paster Add-In for Visual Studio 2008

I had the need today to take a bunch of JavaScript code and paste it into an ASP.NET code behind file.  I was using the script as a basis for a custom script that was placed into the Page using the ClientScript.RegisterClientScriptBlock method.  I did some quick googling and found the Visual Studio Add-In called Smart Paster from Alex Papadimoulis that was just what I was looking for.  It wasn’t supplied in compiled form, but it was easy to build and deploy.  Just open the solution file, compile for Release mode and then copy the two files (from the bin folder) into your Addins folder:

  • SmartPaster2008.AddIn
  • SmartPaster2008.dll

Note: Your Addins folder is located by default at C:\Users\<username>\Documents\Visual Studio 2008\Addins

Simply restart VS2008 and now check out the new Right Click “Paste As” menu option:

smart-paster-example

There are some options via the Configure menu item too.  Very handy!