Among new features in the Visual Studio
extensibility, deploying extensions also changes. Microsoft introduces a
new file type named VSIX (with .vsix extension) for packaging deploying
Visual Studio extensions. This new format is intended as a replacement
for the previous .vsi file format first introduced with Visual Studio
2005. Basically a VSIX package is nothing but a zip archive that is
built with regard to the open packaging convention. This means that if
you rename the .vsix package into .zip, you can browse its content with
any compression tool supporting zips. This kind of package needs to
store some other files:
A [Content_Types].xml file that describes the archive content according to the open packaging convention
An extension.vsixmanifest file storing information on the extension and on how it will be deployed
Binary files for the extension (set named product payload)
Support files, such as license, icons, and so on
VSIX packages cannot deploy
add-ins, macros, and code snippets, whereas they can deploy any other
kind of extensions. You can also deploy extensions via Windows Installer
packages; this is preferable when you need to accomplish specific
requirements such as installing assemblies to the GAC or writing to the
Registry. For all other cases, VSIX packages are a good thing.
Because you cannot deploy
Visual Studio add-ins and code snippets with Vsix packages, you still
need to build a .vsi package or recur to Windows Installer projects.
There are also some other
good reasons for preferring VSIX packages. First, they can check for
updates. Second, they can be uploaded to the Visual Studio Gallery so
that other developers can download your extension directly from the
Visual Studio Extension Manager. (Another good reason is that you do not need to edit a VSIX
package manually. Visual Studio offers an integrated designer for
creating VSIX packages directly into the current project. Continuing the
previous example, double-click the source.extension.vsixmanifest
file in Solution Explorer. This file is added to each extensibility
project at creation time and is the deployment manifest for the
extension. Once this is done, Visual Studio 2010 looks like Figure 1.
Figure 1. Customizing properties for the deployment package.
With the exception of the ID
field, which is filled by Visual Studio, you just need to fill blank and
self-explanatory fields with custom values, as Figure 57.8
exemplifies. It is worth mentioning that VSIX packages are localizable
(check out the Locale combo box) and can target multiple editions of
Visual Studio (click the Select Editions button). You can also specify a
license agreement (License Terms field) adding an existing text file or
RTF file. The References group simply enables specifying other
extensions that the current one depends on. To build the deployment
package, simply build the project. The VSIX package is now available in
the project output folder (Bin\Debug or Bin\Release). With regard to the
previous example, the package is named SnippetCompilerVSPackage.Vsix.
If you double-click such a file, you will be prompted with some
information before installation begins, as represented in Figure 2.
Figure 2. Installing the new custom extension.
By clicking Install,
the new custom extension will be available onto the target system. This
means that you simply need to deploy the VSIX package and you are done.