How do I deploy a Toolbox Control as a VSIX?

Several partners have asked me how they can package up their Visual Studio 2010 Toolbox Controls as a VSIX and deploy it on the Visual Studio Gallery. In the past, we had a Toolbox Control Installer (TCI) which shipped as an MSM in the Visual Studio SDK. A developer building a toolbox control would include the MSM in their MSI which wrote a registry key at install time to let the Toolbox Control know there are new controls available, where they are, and to rebuild the cache. That's changed in VS 2010 and we've made it easier to deploy your Toolbox Control. The support came late in VS 2010 Beta 1 so we didn't include it in the SDK but here's a workaround if you want to try to get your toolbox control working as a VSIX for VS 2010 Beta 1.

Full support will be available in Beta 2.

Step 1: Build your toolbox control, test it, and verify it.

Step 2: Create a new VSIX Project by launching the New Project dialog, select C#, Extensibility, and pick the VSIX Project in the middle pane

image

Step 3: In your VSIX Project, add the files related to your toolbox control.  You can do this using the Add New Item content menu.

image

Step 4:

Create a new .pkgdef file and add it as an item to your project.  The .pkgdef file should be named <YourProject>.pkgdef and it should contain the following info:

[$RootKey$\ToolboxControlsInstaller\WinControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1631b3e7a8fbcce5, processorArchitecture=MSIL]
@="Litware Controls"
"Codebase"="$PackageFolder$\WinControl.dll"

 

Change the WinControl, Version…. part to match the assembly name of your control.  This must be an exact match.

Change the @ property to the name of your control.

Change the Codebase property to point to your DLL.  This is assuming the DLL is in the root of the VSIX, which ends up being installed to the $PackageFolder$ directory on disk.

If you're building a WPF Control, you'll need to add one additional key/value pair:      "WPFControls"="1"

Add that in your pkgdef file below your codebase statement.

Step 5:

For all the additional files you added to your VSIX project, select each one, go to the property grid and mark the “Copy To Output” item to “Copy always”

image

There’s an SDK bug that you will also need to mark the image files as well as “Copy always”.  These are the VSIXProject_Large.png and VSIXProject_Small.png.

Step 6:

Open the VSIX Manifest and modify it to add your own unique ID, company name, version, etc.

In the Content section, click on the drop down and Select VS Package.  In the column beside it, type in the name of your pkgdef file.

Don’t forget to Save your changes.

image

Step 7:

Build.

Once you finish building, you’ll see a VSIX file in your output directory.

image

Step 8:

Test your extension by double clicking on the VSIX file to install it. 

You’ll need to restart VS.

Step 9:

Verify your control shows up in the Extension Manager and in the Toolbox Control.

image

image

 

And that’s it.  You’ve successfully created a VSIX package for your control.

Now go ahead and share it with the world on the Visual Studio Gallery!

Comments

  • Anonymous
    June 15, 2009
    PingBack from http://www.alvinashcraft.com/2009/06/15/dew-dump-june-13-15-2009/

  • Anonymous
    June 15, 2009
    PingBack from http://www.alvinashcraft.com/2009/06/15/dew-dump-june-13-15-2009/

  • Anonymous
    June 17, 2009
    I just added one additional piece to step 4 for those adding a WPF control.

  • Anonymous
    June 19, 2009
    This week on Channel 9, Brian and Dan discuss the top developer news, including: - Peli de Halleux -

  • Anonymous
    July 16, 2010
    I don't see the Extensibility node in the new project dialog. Has this functionality moved somewhere else?

  • Anonymous
    July 16, 2010
    Scratch that, I wasn't aware there was a separate SDK for extensibility.

  • Anonymous
    March 21, 2011
    "Step 4: Create a new .pkgdef file... " I don't see this as an option in the "Add New Item" dialog.. Could you please explain? Thanks.

  • Anonymous
    August 23, 2012
    Great Explanation. Thanks. "Step 4: Create a new .pkgdef file... " I don't see this as an option in the "Add New Item" dialog.. Could you please explain? Thanks. Not Add New Item but, Add Existing Item (Your Dll's)....