Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

Making CopySourceAsHtml add-on work with VS2010

As there are still bloggers who use CopySourceAsHtml add-on for Visual Studio to get syntax highlighted code to their blog posts and there is no guidance in CSAH site how to make it work with Visual Studio 2010 I will give my guidance here. Almost all code in this blog is syntax highlighted by this add-on (read more from my post Visual Studio add-in: CopySourceAsHTML).

Last version of CSAH is available for VS2008 but it is easy to make it work with VS2010. Just follow these steps.

  1. Close VS2010 if it is opened.
  2. Goto folder MyDocuments\Visual Studio 2010.
  3. Move to AddIns subfolder (create it if there is no such subfolder).
  4. Create file called CopySourceAsHtml.AddIn and open it in text editor.
  5. Paste the following XML to editor:

     


    <?xml version="1.0" encoding="utf-8" standalone="no"?>

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

    <HostApplication>

    <Name>Microsoft Visual Studio Macros</Name>

    <Version>10.0</Version>

    </HostApplication>

    <HostApplication>

    <Name>Microsoft Visual Studio</Name>

    <Version>10.0</Version>

    </HostApplication>

    <Addin>

    <FriendlyName>CopySourceAsHtml</FriendlyName>

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

    <Assembly>JTLeigh.Tools.Development.CopySourceAsHtml, Version=3.0.3215.1, Culture=neutral, PublicKeyToken=bb2a58bdc03d2e14, processorArchitecture=MSIL</Assembly>

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

    <LoadBehavior>1</LoadBehavior>

    <CommandPreload>0</CommandPreload>

    <CommandLineSafe>0</CommandLineSafe>

    </Addin>

    </Extensibility>


  6. Save file and close it.
  7. Run VS2010 and activate add-on if it is not activated yet.

That’s it. If you are heavy user of CSAH then I recommend you to bookmark this post. :)

Comments

David Carter said:

Fantastic tool! You can also get it using NuGet and the Power Productivity Tools. I've detailed how to do this in a blog post: softwaredevelopmentexperiences.blogspot.com/.../how-to-format-code-in-your-blog-easy.html

# November 28, 2011 6:10 PM

Dave Haynes said:

I was having lots of problems with various tools for putting code on my blog. I finally rolled my own solution and put it up at http://www.blogtrog.com -- you get some code to dump in your blog that will generate a pretty iframe where possible, and basic syntax highlighted code when it's not possible to have the iframe (like in Google Reader).

# December 2, 2011 10:32 AM

DigiMortal said:

HTML copy support that comes with productivity tools doesn't produce so good HTML as CSAH does. CSAH produces HTML that is not so much dependent on small CSS issues.

# December 10, 2011 8:22 PM