I'm Keyvan Nayyeri, a 25 years old Ph.D. student at
the Computer Science department of
the University of Texas at San Antonio.
I'm also
a Software Architect and Developer and previously held a B.Sc.
degree in Applied Mathematics.
This is my blog where I publish content about various topics specifically Programming Languages and Compilers, Software
Engineering and Programming.
A blog post by Andreas Erben about updating CopySourceAsHtml add-in for Visual Studio 2008 Beta 2 (which was a part of Scott Hanselman's Ultimate Developer Tools 2007) bit me to write this point and give a more general description about updating your Visual Studio 2005 add-ins for Visual Studio 2008. I know working on this stuff for the book makes me old!!
In general, you can upgrade a Visual Studio 2005 add-in for Visual Studio 2008 by copying its DLL file, add-in file and configuration file to the Addins folder of Visual Studio 2008 storage folder in your documents and making some changes as follows.
You need to open the add-in file (which has a .AddIn extension). This file has an add-in icon which makes it different from other files. This add-in file is an XML document with a special structure and has an XML namespace set to http://schemas.microsoft.com/AutomationExtensibility.
I don't want to talk about the structure of this file here. You can order my book when it came out to learn these things!! But there is one point to update add-ins to Visual Studio 2008.
As you see in the XML file, there are one or two <HostApplication /> elements that have a child <Version /> element. For Visual Studio 2005 add-ins this is set to 8.0 which is the internal version of Visual Studio Whidbey. For example, for CopySrouceAsHtml 2005 it's like this:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>8.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>8.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>5</LoadBehavior>
<CommandPreload>0</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
</Addin>
</Extensibility>
The first <HostApplication /> element is for Visual Studio Macros IDE and targets add-ins in this environment and the second <HostApplication /> element is for main Visual Studio IDE. You can update the <Version /> element of these elements to 9.0 (which is the internal version of Visual Studio Orcas) in order to make them work for Visual Studio 2008.
<?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>5</LoadBehavior>
<CommandPreload>0</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
</Addin>
</Extensibility>
After doing this, your add-ins will be loaded with Visual Studio (and its Macros IDE) and are accessible via Add-in Manager dialog.

As Microsoft hasn't changed previous DTE structure and just added new features beside it, almost all Visual Studio 2005 add-ins should work with Visual Studio 2008 unless they use a very special API that is changed in Orcas.
Leave a Comment