Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links

News

Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories

Archives

Post Categories

.NET Framework

Blogroll

Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

Creating, packaging and deploying extensions for Visual Studio 2010

Microsoft Visual Studio is an extensible environment, in that it is possible creating and installing additional components offering new functionalities that the IDE does not include. As you may know, Visual Studio 2010 is a revolutionary environment because most of its architecture is based upon WPF and this also changes the extensibility. Except for Addins and Code Snippets, that you still package via the old .vsi file format, VS 2010 introduces the new .vsix format that enables packaging and installing the so called extensions, thus additional components such as templates, tool windows, editor extensions and user controls to be installed to the Toolbox. Visual Studio 2010 has also a new tool named Extension Manager which allows managing local extensions and downloading new ones from the Visual Studio Gallery.

To develop this kind of extensions (except for project/item templates) you need the Visual Studio 2010 SDK, available from here. Once installed you will find in the IDE, other than a series of tools and documentation, a number of new project templates for the IDE extensibility (including the code editor). For instance, imagine you want to create a new WPF user control that will be later deployed and installed to the Toolbox automatically, instead of requiring the user to make this manually.

Click File|New|Project. Then, expand the  Visual Basic node (it's also available for C#), then the Extensibility node. In the available templates list, select the one named WPF ToolBox Control:

After a few seconds the new project is ready. Actually it looks like a normal project for implementing a WPF user control:

You can replace the default code and implement a control that makes more sense but this is not the goal of this post, so you can leave unchanged the code. In Solution Explorer you can notice the presence of a file called ProvideToolboxControlAttribute.vb, which provides extensibility support, and of a file called source.extension.vsixmanifest. This has Xml structure and contains information on the package that will be built in order to deploy the extension and that can be luckily edited within the IDE. Double click such a file, then take a look at VS 2010:

Most required information is self-explanatory. Particularly you can specify the author, the version number for the extension, a description, a license agreement (text or RTF format), an icon and an image that will be used as a preview by the Extension Manager tool. Also you can specify references to existing extensions (References box) and additional contents (optional) to deploy together with the user control (Content box). It is very interesting how you can select the Visual Studio 2010 editions that the extension targets. Click Select Editions and you will see the following dialog where you can specify the desired editions (including Shells):

Now build the project. If you press F5 a new instance of Visual Studio (known as Experimental Hive) will start. This is useful for debugging the extension, but we are not interested in this scenario, since we want to understand how to deploy the extension. Inside the Bin\Debug (or Bin\Release) subfolder you will find a file with .vsix extension. This is actually the file that we will distribute to our users and that will install the component. Double click this file and you will see a dialog where you will get information on the component and you will select the Visual Studio 2010 editions, among the ones available on the machine, and that shows the license agreement to accept:

 

Click Install. When you restart Visual Studio 2010 you will see the WPF user control inside the toolbox:

 

In the previous figure you can see the new user control twice. In fact it is available in a new tab and in the All WPF Controls tab. In order to manage the new extension, select Tools|Extension Manager. Such a tool looks like this:

 

Notice how you can browse all available extensions or only extensions from the specified category (such as controls). You can see how the control can be just disabled or uninstalled. Also, a number of information is available, such as the producer name and a preview image. It's important to understand that the .vsix file format is recognized by the Visual Studio Gallery and allows sharing our extensions over the Internet so that other developers will take advantage of our work.

Alessandro

Print | posted on lunedì 15 marzo 2010 00:17 | Filed Under [ Visual Studio 2010 Visual Basic Visual Studio Extensibility ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 7 and 2 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET