In a recent presentation I mentioned two addins for Visual Studio that I love. I checked and was happily surprised they had been updated for Visual Studio 2008.
The first of these is SmartPaster. With SmartPaster you select some text, then come to Visual Studio, right click and pick “Paste As…” You’re then given four options: Comment, String, StringBuilder, and Region. I find the String or StringBuilder options very useful. When I write SQL I usually do it over in SQL Server Management Studio, I then come to my app and want to paste it in. This saves me from having to put all the quotes and concatenation, a huge time saver. Comment is also handy, I often type up a bunch of comments in a text editor, then want to paste them in quickly and easily. This takes care of line wrapping, etc.
The second tool is an essential one for any blogger: CopySourceAsHTML. It’s pretty simple, highlight a bunch of code, right click and pick “Copy As HTML…”. A dialog pops up that gives you some option to tweak the code. You can over ride the default font, font size, tab size, and other handy things. I use this for all my blog posts, I find it’s the easiest way to get the most accurate syntax coloring.
Installing either addin is very simple, extract the zips, then just navigate to your C:\Users\<username>\Documents\Visual Studio 2008\Addins folder (create it if it doesn’t exist) and copy the appropriate files in there and restart Visual Studio 2008. See the respective websites if you need more detailed info.
If you are still on Visual Studio 2005, there are 2005 versions of these addins as well, available from their sites.