Display nicely formatted .NET source code on your blog

The best method of displaying nicely formatted code in a blog post in my experience is a Visual Studio plugin called CopySourceAsHtml.

Once the plugin is installed simply select the code you want to display and choose Copy As HTML. A clean HTML representation of your code will be copied onto the clipboard which can then be pasted into your blog editor of choice (I like Windows Live Writer).

You have to speak louder, I'm wearing a towel!

The nice thing about CopySourceAsHtml is that the code on your blog looks exactly like it would in Visual Studio, right down to highlighting class names.

CopySourceAsHtml also works on any file in Visual Studio be it C#, VB.NET, XML, HTML, XAML or JavaScript. The version of C# or VB.NET also doesn't matter.

Finally CopySourceAsHtml works with almost any blog. Since it is just HTML there is nothing that needs to be done on the server.

CopySourceAsHtml is free and can be download here. To get it up and running with VS2008 follow these instructions (its not hard).

kick it on DotNetKicks.com