52.4. The Structure of .AddIn Files

Besides the add-in assembly, which is like its heart and contains all its implementation, there is also an XML file that acts as its configuration file with an .AddIn extension. This .AddIn file was first introduced in Visual Studio 2005 to simplify the process of add-in deployment. Prior to this version, you had to register the add-in COM component to deploy it, and this had its own difficulties. But now, thanks to .AddIn files, deployment is much easier.

An .AddIn file is an XML file with a specific schema that is defined by the http://schemas.microsoft.com/AutomationExtensibility namespace. When you create an XML file and set its XML namespace to this, Visual Studio automatically gives you IntelliSense to work with .AddIn files and edit them easily.

Like any other XML file, .AddIn files have their own special structure and format. Discussing all elements and attributes of this file is beyond the scope of this book, but you can find a detailed discussion about this file in Chapter 6 of Professional Visual Studio Extensibility (ISBN: 9780470230848).

Here in a nutshell is an introduction to the structure.

An .AddIn file has an <Extensibility /> root element, which contains two possible child elements including <HostApplication /> and <Addin />.

<HostApplication /> defines a host application for an add-in and <Addin /> configures the add-in with some information about it to set it up. Visual Studio looks into these elements to find the necessary information and load an add-in.

Let's finish the discussion about .AddIn files by pointing to a technique that can help you update Visual Studio 2005 add-ins to Visual Studio 2008. Generally, there haven't been any major changes in add-in development between Visual Studio 2005 and 2008, so many of the add-ins for Visual Studio 2005 should work with Visual Studio 2008. But they will need a modification in their .AddIn files for them to be loaded by Visual Studio 2008.

<HostApplication /> has a child <Version /> element that must be set to the version number of the compatible host application. For a Visual Studio add-in there are two possible host applications, including Visual Studio IDE and Visual Studio Macros IDE that both use the same version numbers. For Visual Studio 2005 the <Version /> element was set to 8.0 (the internal version number of Visual Studio 2005) and for Visual Studio 2008 it must be set to 9.0. So if you have an existing Visual Studio 2005 add-in and are sure its code can work with Visual Studio 2008, then you can simply update it by modifying these version numbers to 9.0.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251