It’s been quite a long while since the last time that I wrote something about Visual Studio Extensibility as a topic that I used to write a dedicated book for. Therefore, to improve my blogging activity and feed those readers of my blog who are interested in VSX, here I’m going to publish a post series with a few posts that discuss add-in and integration package, contrast their similarities and differences, and talk about the process of upgrading an add-in to a VSPackage.
By the way, this is a good topic to elaborate because in many areas add-ins and VSPackages may overlap in their applications, and it may be difficult for a newbie to choose which of these two main extensibility options to use.
Visual Studio Extensibility consists of a set of different extensibility options available in Microsoft Visual Studio IDE to let developers extend this popular IDE for their requirements.
In this post series my main goal is to talk about two famous and common extensibility points included in the IDE: add-in and VSPackage.
Let’s take a look at the objectives for this post series before digging into them:
- Discovering the concept of add-in and VSPackage and their applications
- Understanding the similarities and differences between these two extensibility options both in applications and in their access to VS API
- Learning when to use an add-in and when to use a VSPackage
- Learning how to upgrade an add-in to a VS SDK Package when necessary
An Overview of Visual Studio Extensibility, Add-In, and VSPackage
The first thing that I need to talk about is the role of add-in and VS SDK package in Visual Studio Extensibility and a short history of them. This can give a general understanding of the differences between these two options to you.
Visual Studio Extensibility (VSX) consists of a set of basic concepts, general API, and different options that form its foundation. Some of these options are very well-known for their role in VSX, and are actually a first-level extensibility option while others may be placed in the second and third level per their commonality in VSX.
Speaking of these three levels, we can split all Visual Studio Extensibility points into three levels based on their commonality in extensibility and their role.
The first level consists of some options that are specifically designed for extensibility like add-ins, macros, and VS SDK packages. The second level consists of some options that are designed for extensibility but are targeting other fields as well. Some examples are debugger visualizers or templates. And the third level of extensibility options contains some features of Visual Studio that are specifically designed for other purposes but can help the extensibility as a side-application.
But here our focus is on the first level and some very well-known extensibility points including add-ins and VS SDK packages. Both these options are primary extensibility options for Visual Studio. Add-ins have been with this IDE from the early days but VS SDK packages are introduced as a part of Visual Studio SDK in the newer versions.
As Visual Studio was built on top of COM technology, add-ins were introduced in the first version as an extensibility option and were implementing a COM interface. Actually add-in was the first extensibility option for Visual Studio that we know. Add-in has been improved in each new version of Visual Studio. Introduction of the .NET framework in 2002 had an important impact on add-in structure and changed the way that an add-in could be developed. So Visual Studio 2002 came with new structure for add-ins based on the .NET languages. While developers had to implement an interface (due to the COM nature of Visual Studio all the time), they could use cool new features introduced with the .NET framework. Microsoft made this possible via the interoperability between the .NET and its prior development technology, COM. Later with Visual Studio 2005 Microsoft improved add-in again and used XML to simplify its deployment process.
But the story of VS SDK package is a little different. The growing importance of Visual Studio in the past 10 years convinced Microsoft to start a new program called Visual Studio Industry Partner program (commonly known as VSIP program). This program targets bigger Microsoft partners that are working around Visual Studio and allows them to have access to many stuff related to Visual Studio.
As you’ll read later in this series, there were some limitations with add-ins in extending Visual Studio while many developers and partners wanted better ways to extend the IDE. The result was that Microsoft finally introduced a new extensibility feature called VS SDK package. VSPackages first introduced to VSIP members as a part of a private program and then became public to everyone.
These two options are nowadays the most common ways to build extensions for Visual Studio and many of the current extensions for the IDE are written as an add-in or VS SDK package, however, Visual Studio 2010 is supposed to change extensibility of Visual Studio significantly by introducing Visual Studio extensions as the new and great way to expand Visual Studio features.