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
- By default it will be installed toC:Users<username>DocumentsVisual Studio 2008Addins
- Create a folder named Addins under C:Users<username>DocumentsVisual Studio 2010 and copy CopySourceAsHtml.AddIn here.
- Modify Line #5 and #9 change <Version>9.0</Version> to<Version>10.0</Version>
- Launch Visual Studio 2010 –> Tools –> Addin Manager, if you see CopySourceAsHtml shows up, then it’s enabled successfully.
6. Now you can select the code and get html by clicking Copy As Html
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;
6 namespace HelloWorld
8 class Program
10 static void Main(string args)
12 // My first application
13 System.Console.WriteLine(“Hello, World!”);