CopySourceAsHtml for Visual Studio 2010

CopySourceAsHtml is an add-in for Microsoft Visual Studio 2008 that allows you be able to quickly get your code as HTML from Visual Studio, just like being able to save it as a HTML file from the Save As dialog. It’s very helpful if you frequently post code to blog or send code in email.

I recently switched to Visual Studio 2010 and noticed this plug in is not ready for Visual Studio 2010 yet. Here is how you can get it work for Visual Studio before CopySourceAsHtml owner releases an official update to support Visual Studio 2010.

Download latest CopySourceAsHtml msi and install it

  1. By default it will be installed toC:Users<username>DocumentsVisual Studio 2008Addins
  2. Create a folder named Addins under C:Users<username>DocumentsVisual Studio 2010 and copy CopySourceAsHtml.AddIn here.
  3. Modify Line #5 and #9 change <Version>9.0</Version> to<Version>10.0</Version>
  4. Launch Visual Studio 2010 –> Tools –> Addin Manager, if you see CopySourceAsHtml shows up, then it’s enabled successfully.image

6. Now you can select the code and get html by clicking Copy As Html

image

This is an example. CopySourceAsHtml also provides options to show/hide control line number, word wrap and so on.

1 using System;

2 using System.Collections.Generic;

3 using System.Linq;

4 using System.Text;

5

6 namespace HelloWorld

7 {

8 class Program

9 {

10 static void Main(string[] args)

11 {

12 // My first application

13 System.Console.WriteLine(“Hello, World!”);

14 }

15 }

16 }


Comments

6 responses to “CopySourceAsHtml for Visual Studio 2010”

Leave a Reply