...Technology Simplified

Friday, April 20, 2012

copy code and line numbers in visual studio 2010

No comments :

There is an addon supported in visual studio to copy syntax highlighting and line numbers .Download it from the link http://copysourceashtml.codeplex.com/
It is version for VS2008 ,you need to make some changes to support VS2010.
Download latest CopySourceAsHtml msi and install it
1.By default it will be installed to C:\Users\<username>\My Documents\Visual Studio 2008\Addins
2.Create a folder named Addins under C:\Users\<username>\My Documents\Visual 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.

1

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

2

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 }

No comments :

Post a Comment