How to create Visual Studio Add-Ins

Creating the Basic Add-In
As your first step you want to create the basic shell of your add-in.
To create an add-in in Visual Studio, do the following:

From the Visual Studio menu select File and choose New Project.
In the New Project dialog box in the left pane, select Other Project
Types, expand the Extensibility type, and in the right pane choose
Visual Studio Add-In and then click OK.

Name your project. For this example I'll use CodeFocusAddIn.

The Add-In Wizard will then start up. On page 1 you need to specify
the language you will use to develop your add-in. You can choose from
Visual Basic, C#, J# and two styles of C++ development. I'll use
Visual Basic.

Page 2 allows you to specify the host(s) for your add-in. By default
the hosts are Visual Studio 2005 and Visual Studio 2005 Macros. Choose
the host(s) you wish to support.
On page 3 you'll provide the name and description of your add-in.

Now you'll specify some options for your add-in. On page 4, specify
whether your add-in will be called from the toolbar, whether you want
the add-in to load when the Visual Studio shell starts, and whether
the add-in will activate any modal forms.

Page 5 allows you to provide information in the "About" box for your add-in.

Finally on page 6 click Finish. The wizard will create your add-in
project and all supporting files.

At this point you want to look at two specific files:
<your-project-name>.AddIn and Connect.VB. The .AddIn file contains XML
information that is used to register your add-in with the Visual
Studio shell. Listing 1 contains the contents of this XML.

The Connect.VB file contains the guts of your add-in. This code
implements two interfaces: IDTExtensibility2 and IDTCommandTarget,
which the Visual Studio IDE uses to communicate with your add-in. To
add custom code to your add-in you'll use the Connect.VB. file.

No comments:

Post a Comment