Click here to Skip to main content
13,591,308 members
Click here to Skip to main content
Add your own
alternative version


57 bookmarked
Posted 28 Apr 2006
Licenced CPOL

Visual Studio 2005 Toolbox Utility

, 28 Apr 2006
Rate this:
Please Sign up or sign in to vote.
This useful utility makes it easy to install or uninstall user controls to the Visual Studio 2005 toolbox.


If you have ever tried to write a user control in Visual Studio.NET, you'll already know that the process is bittersweet.  On one hand, writing the control itself is painless and Visual Studio 2005 has greatly improved the process of making controls work on multiple .NET platforms via design-time attributes and "asmmeta" assemblies.  On the other hand, however, deploying controls and adding them to the Toolbox is a process rife with errors.  It is definitely not a matter of adding a registry key (as I would have liked to see).

After getting a lot of e-mails from customers asking me how to add real-time GPS controls to their Toolbox, I decided that I needed to come up with some kind of utility to get the job done.  Visual Studio 2005 does already have some mechanisms for installing user controls, such as ".vsi" files, but unfortunately this approach typically results in a "Package Load Failure" and does not have a guarantee to work on every VS2005 installation.  Fortunately, Chetan Chudasama generously gave out source code in his blog which explains how to add or remove Toolbox controls using code and the "DTE" (Design-Time Environment) for Visual Studio.  Thanks to his efforts, I was able to turn the code into a command-line utility which is well-suited for installers (which is usually when Toolbox controls are installed).

This article describes how to use the utility and integrate it into your own installers.  You are welcome to redistribute this utility and I consider it freeware. 


The Toolbox utility is a single executable which processes one or more tasks via the command-line.  Since the Toolbox itself can change depending on whether you are working with Desktop Framework 2.0 or Compact Framework 2.0 applications, different commands exist which let you add desktop or mobile device controls.  I have optimized the utility to minimize the calls to the DTE and it runs a couple of seconds faster than Chetan's code if you have multiple assemblies to install.

When the utility runs, the following window will appear.  Since the utility must launch a hidden instance of Visual Studio 2005 (devenv.exe), this can be a time-consuming process.  A progress bar helps to show that something is actually happening during Toolbox modifications:

Screen shot of the Toolbox Utility

I kept the window free from company logos and branding so it will look like your own utility.  The command line must follow the following syntax:

Toolbox.exe [/silent] /installdesktop  assembly toolbox_tab [...]
Toolbox.exe [/silent] /installpocketpc assembly toolbox_tab [...]
Toolbox.exe [/silent] /installcustom template assembly toolbox_tab [...]
Toolbox.exe [/silent] /uninstall toolbox_tab [...]
... each command is as follows:
/silent          Suppresses all output during installation or uninstallation.
/installdesktop  Installs controls written for Desktop Framework 2.0 to the toolbox.
/installpocketpc Installs controls written for Compact Framework 2.0 to the toolbox.
/installcustom   Installs controls written for a specific kind of device project to the toolbox.
/uninstall       Removes an entire Toolbox tab.
[...]            Multiple install commands can be appended to install/uninstall multiple controls at one time.
... and the parameters for each command are:
"assembly"    is the absolute path to an assembly containing user controls.
"toolbox_tab" is the name of the Toolbox Tab where control should be installed.
"template"    is the name of a ZIP file from the Templates folder indicating a specific kind of project.
The utility can install or uninstall any number of controls in one call, which is important since about 3-5 seconds are required just to launch and shut down Visual Studio 2005. The commands will vary depending on which Toolbox you need to modify.

Installing Desktop User Controls

To install desktop controls, you must use the /installdesktop command and pass in the path to an assembly as well as the name of the Toolbox tab to add the control to:
Toolbox.exe /installdesktop "C:\MyUserControl.dll" "My Toolbox Tab Name"

Installing PocketPC User Controls

To install mobile device controls, such as PocketPC controls for Windows Mobile 2003, you must use the /installpocketpc command and pass in the path to an assembly as well as the name of the Toolbox tab to add the control to:
Toolbox.exe /installpocketpc "C:\MyUserControl.PocketPC.dll" "My Toolbox Tab Name (PocketPC)"

... if you provide the same user controls for multiple platforms, you should add "(PocketPC)" to the Toolbox tab name to keep the controls separated.

Installing User Controls for Custom Toolboxes

To install controls for platforms not yet released at the time of this article, you must use the /installcustom command and pass in a "template name" along with the path to an assembly, as well as the name of the Toolbox tab to add the control to. The template is the filename of a template ZIP file. You can typically find ZIP files here:
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\CSharp\

... you don't need the name of the directory since Visual Studio 2005 keeps all of the ZIP file names unique. The following example installs controls for Smartphone:

Toolbox.exe /installcustom "" 
"C:\MyUserControl.Smartphone.dll" "My Toolbox Tab Name (Smartphone)"

Uninstalling Controls

There is no mechanism for uninstalling a single control from the Toolbox; entire Toolbox tabs are deleted at one time. This is another reason why it's a good idea to add text to the Toolbox tab name to keep controls separate per platform. To uninstall a Toolbox tab, specify the full tab name:
Toolbox.exe /uninstall "My Toolbox Tab"

Clean Re-Installation of Controls

The Toolbox is not smart enough to know when controls already exist in a tab. This can cause problems because the same control would get added multiple times! To solve this problem, begin the command line with an /uninstall command immediately before an install command. This will cleanly re-install the toolbox controls:
Toolbox.exe /uninstall "My Toolbox Tab" /installdesktop "C:\MyUserControl.dll" "My Toolbox Tab"

Silent Operation

If for some reason you don't want the progress bar to display, add the /silent command to the command line:
Toolbox.exe /silent /uninstall "My Toolbox Tab" /uninstall "Another Toolbox Tab"


The experience of designing user controls for Visual Studio 2005 has improved greatly over Visual Studio 2003, but the process of installing a custom user control is still tedius. Perhaps the folks at Microsoft could use the registry to search for and install custom user controls, much like the AssemblyFolders registry key is used to locate custom assemblies. This change would vastly simplify installation of custom user controls in the future.

If you find any bugs or wish to see improvements, you can post in the thread on my web site for this utility, located here: Toolbox Utility Forum.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jon Person
Software Developer (Senior) Black Knight Financial Services
United States United States
Hi there! From 2004 to 2009 I ran a company called "GeoFrameworks," publishing two components called GPS.NET and GIS.NET which helped developers quickly write location-based services. Now, I've released the source code for GPS.NET to CodePlex for you to use as you see fit.

GPS.NET 2.0 on CodePlex
GPS.NET 3.0 on CodePlex

... I've also released the source code of a library called the "GeoFramework," a collection of commonly used classes such as Latitude, Longitude, Distance, Speed, and Position:

GeoFramework 1.0 on CodePlex
GeoFramework 2.0 on CodePlex

I'm now taking a break from programming, but I really appreciate the positive feedback from readers!

You may also be interested in...

Comments and Discussions

GeneralNice Utility Pin
thatraja15-Jan-10 23:19
memberthatraja15-Jan-10 23:19 
NewsThis project has been moved to CodePlex Pin
Jon Person23-Jan-08 19:29
memberJon Person23-Jan-08 19:29 
GeneralIt does work for me.. Pin
Rmaman13-Jun-07 4:33
memberRmaman13-Jun-07 4:33 
QuestionWhat changes are necessary for this to work with VB/C# 2005 Express? Pin
KevinHall24-May-07 10:09
memberKevinHall24-May-07 10:09 
GeneralSource Code Now Available Pin
Jon Person28-Nov-06 12:21
memberJon Person28-Nov-06 12:21 
GeneralRe: Source Code Now Available Pin
lgaudouen30-Nov-06 20:59
memberlgaudouen30-Nov-06 20:59 
GeneralRe: Source Code Now Available Pin
Jon Person5-Dec-06 11:40
memberJon Person5-Dec-06 11:40 
GeneralRe: Source Code Now Available Pin
otrack15-Mar-07 18:47
memberotrack15-Mar-07 18:47 
GeneralRe: Source Code Now Available Pin
otrack16-Mar-07 5:12
memberotrack16-Mar-07 5:12 
GeneralRe: Source Code Now Available Pin
Jon Person23-Jan-08 19:30
memberJon Person23-Jan-08 19:30 
GeneralRe: Source Code Now Available Pin
Daniel Cazzulino [Solution Architect MVP]11-Apr-07 6:26
memberDaniel Cazzulino [Solution Architect MVP]11-Apr-07 6:26 
GeneralRe: Source Code Now Available Pin
Jon Person11-Apr-07 6:38
memberJon Person11-Apr-07 6:38 
GeneralThrows SystemNullExceptions Pin
XH_expanders28-Nov-06 12:01
memberXH_expanders28-Nov-06 12:01 
AnswerRe: Throws SystemNullExceptions Pin
Jon Person28-Nov-06 12:19
memberJon Person28-Nov-06 12:19 
GeneralRe: Throws SystemNullExceptions Pin
mail865955-Dec-06 12:03
membermail865955-Dec-06 12:03 
GeneralRe: Throws SystemNullExceptions Pin
Jon Person23-Jan-08 19:32
memberJon Person23-Jan-08 19:32 
GeneralExcellent, thanks! [modified] Pin
qjdnnbfjqyyk17-Aug-06 4:08
memberqjdnnbfjqyyk17-Aug-06 4:08 
GeneralRe: Excellent, thanks! Pin
WolfMoon30-Aug-06 3:17
memberWolfMoon30-Aug-06 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02-2016 | 2.8.180618.1 | Last Updated 28 Apr 2006
Article Copyright 2006 by Jon Person
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid