Posting code to your blog from Visual Studio

It is painful to post code to your blog without any special considerations. In the worst case you have to edit the resulting HTML yourself.

Working with Community Server gave me quite some pain here, so I looked around for some options that exist.

I found those methods:

  1. Copy from Visual Studio to Word 2007, remove TABs, remove hard-returns and replace with shift-returns. Mark as preformatted-html. Post the post to Community Server. Then open the Community Server built in editor and paste the code again in there. Painful. Does not work very well.
  2. Mike Stall suggests writing your own RTF to HTML converter: "Writing an RTF to HTML converter, posting code in blogs."
  3. A Visual Studio add-in that copies the source as HTML by Colin Coller:
    listed in
    Read also: or
  4. A word macro that helps you with converting the code from Cory Smith: Format Code to HTML within a VS.NET 2K3 Macro (leveraging Microsoft Word)
  5. A JavaScript based formatter:
  6. Use a CSS stylesheet that formats code for you of Jean-Claude Manoli:
  7. Further reading in the comments of Brad Adam's blog:


I think the Visual Studio add-in solution is probably the most promising here.

Posted Apr 18 2007, 02:14 PM by Andreas Erben


Scott Munro wrote re: Posting code to your blog from Visual Studio
on 04-23-2007 16:52

This is something that I looked into a while ago... I didn't find much at all. Either the community has done some work since then... or you can google better than I can :)

Andreas Erben wrote re: Posting code to your blog from Visual Studio
on 05-02-2007 12:31

... or it is a combination of both :) is a .Net Community Blog powered by daenet GmbH.