Pages

Thursday, September 16, 2010

Creating a Visual Studio Add-In in 1 Minute




This article introduces the basics of Visual Studio Add-In (aka "Plug-In" in Java terminology) creation.

Note: This information is valid for every version of Microsoft Visual Studio. Examples will be given over Visual Studio 2008 and .NET version 3.5.

First, choose File --> Create --> Project. After that choose "Extensibility Project" type and "Visual Studio Add-In".


Then, you can choose "Next" for every step of the Add-in wizard. And finally press "Finish" for the last step:


After that, the add-in project is created. Required DLLs and directory structures are ready. "Connect.cs" class is the most important part and starting point of the add-in. And ExampleAddIn.AddIn file is the add-in descriptor file, which has the basic information (eg. add-in DLL file location, about info...) of add-in.

"OnConnection" method is the starting point of add-in execution. _applicationObject and _addInInstance objects are taken at the start as default. These objects are used to have control over Visual Studio application actions. As an example, let's put an "hello world" dialog at the startup of add-in:


You can enable add-in (and also set the add-in to run on the startup and/or command line) using Tools --> Add-in Manager... menu and the following screen:


Once you press F5, you will see Visual Studio re-starting and the "hello world" dialog:

Specific add-in examples, details and configurations will be explained in future posts.

1 comment:

  1. Wow, Fantastic Blog, it’s so helpful to me, and your blog is very good,
    I’ve learned a lot from your blog here, Keep on going, my friend, I will keep an eye on it,

    ReplyDelete