Using CopySourceAsHtml with Visual Studio 2008 (beta 2 and yes, also RTM)

UPDATE: I did not mention it previously, but this also works with RTM. 

The tool CopySourceAsHtml (CSAH) is invaluable for any code-oriented blogger.
Thanks a lot to Colin Coller and J.T. Leigh & Associates Inc.!

Currently there is no Visual Studio 2008 version of this great Add-in available to download.
It is very easy though to make it work with VS 2008.
In the Add-in-path of VS 2005
(in Vista it is usually C:\Users\USERNAME\Documents\Visual Studio 2005\Addins)
you will find the following files:

  • CopySourceAsHtml.dll
  • CopySourceAsHtml.AddIn
  • CopySourceAsHtml.dll.config

and possibly: CopySourceAsHtml.pdb :)

  1. Copy those files to the AddIn-Path of VS 2008
    (in Vista it is usually C:\Users\USERNAME\Documents\Visual Studio 2008\Addins)
  2. Open CopySourceAsHtml.AddIn in a text- or XML-editor in the VS 2008 AddIn-folder.
  3. Change as seen below and save the changed file back into the VS 2008 Add-in folder.
    The original file had <Version>8.0</Version> instead.

<?xml version="1.0" encoding="UTF-16" standalone="no"?>

<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">

    <HostApplication>

        <Name>Microsoft Visual Studio Macros</Name>

        <Version>9.0</Version>

    </HostApplication>

    <HostApplication>

        <Name>Microsoft Visual Studio</Name>

        <Version>9.0</Version>

    </HostApplication>

    <Addin>

        <FriendlyName>CopySourceAsHtml</FriendlyName>

        <Description>Adds support to Microsoft Visual Studio 2005 for
copying source code, syntax highlighting, and line numbers as
HTML.</Description>

        <Assembly>CopySourceAsHtml.dll</Assembly>

        <FullClassName>JTLeigh.Tools.CopySourceAsHtml.Connect</FullClassName>

        <LoadBehavior>1</LoadBehavior>

        <CommandPreload>0</CommandPreload>

        <CommandLineSafe>0</CommandLineSafe>

    </Addin>

</Extensibility>

 
In Visual Studio 2008 go to Tools/Add-in-Manager:
image
Activate the AddIn:
image
 
Gratulations. Now you can use CopySourceAsHtml with Visual Studio 2008!
 

Posted Aug 01 2007, 11:50 PM by Andreas Erben

Comments

Brig Lamoreaux wrote re: Using CopySourceAsHtml with Visual Studio 2008 (beta 2)
on 08-16-2007 23:16

Hi Andrea,

I haven't played that much of getting CopyAsHTML into VS2008, but I did recently do a review on tools to copy source as HTML. Check it out.

brigl.blogspot.com/.../review-of-copy-source-as-html-tools.html

Scott Hanselman's Computer Zen wrote Scott Hanselman's 2007 Ultimate Developer and Power Users Tool List for Windows
on 08-24-2007 2:51
Keyvan Nayyeri wrote Update Visual Studio 2005 Add-ins for Visual Studio 2008
on 08-31-2007 20:13

A blog post by Andreas Erben about updating CopySourceAsHtml add-in for Visual Studio 2008 Beta 2 (which

Brownie's Blog wrote Getting formatted code onto the web
on 01-05-2008 9:54

Getting formatted code onto the web

?????????DM ?? Blog Archive » Scott Hanselman’s 2007 Ultimate Developer and Power Users Tool List for Windows wrote ?????????DM ?? Blog Archive &raquo; Scott Hanselman&#8217;s 2007 Ultimate Developer and Power Users Tool List for Windows
on 01-07-2008 20:15

Pingback from  ?????????DM  ?? Blog Archive   &raquo; Scott Hanselman&#8217;s 2007 Ultimate Developer and Power Users Tool List for Windows

Sagara.NET wrote CopySourceAsHtml in Visual Studio 2008
on 03-02-2008 5:37

CopySourceAsHtml in Visual Studio 2008

Shahed Khan (MVP C#) wrote The Big Ten Life and Work Changing Utilities from Scott Hanselmans BLOG
on 03-11-2008 6:50
Shawn Ji wrote CopySourceAsHtml VS2008
on 03-25-2008 8:44

CopySourceAsHtml是VS常用的插件,可以把VS里的代码复制成HTML代码,并保留的格式,可用于粘贴在支持HTML编辑的Blog等。VS2008中也有办法使用。

Arjan Zuidhof wrote re: Using CopySourceAsHtml with Visual Studio 2008 (beta 2)
on 04-02-2008 15:18

The tool is nice, I used it under VS2005. Only problem now is, I exclusively have VS2008 on my machine. This blocks the CopySourceAsHtml from installing, cause it needs VS2005 to be present....

All About Interop wrote CopySourceAsHTML in Emacs? Htmlize.el
on 04-11-2008 8:26

There's a nice add-in for Visual Studio called CopySourceAsHTML (for VS2005 , VS2008 ), which I have

James Newton-King wrote Display nicely formatted .NET source code on your blog
on 05-13-2008 12:43

The best method to display nicely formatted code on a blog in my experience is a Visual Studio plugin

Raihan wrote re: Using CopySourceAsHtml with Visual Studio 2008 (beta 2 and yes, also RTM)
on 06-25-2008 2:41

CopySourceAsHtml always inserts some extra spaces in my code. How do I prevent that?

Andreas Erben wrote re: Using CopySourceAsHtml with Visual Studio 2008 (beta 2 and yes, also RTM)
on 07-19-2008 17:24

Hi, I have not seen the scenario with the "extra spaces". However, I did not write the software. Please contact the author.

developers.de is a .Net Community Blog powered by daenet GmbH.