Click here to Skip to main content
13,090,730 members (45,917 online)
Click here to Skip to main content
Add your own
alternative version


24 bookmarked
Posted 20 Sep 2005

Command line application to install components into ToolBox

, 20 Sep 2005
Rate this:
Please Sign up or sign in to vote.
An article on installing components to VS ToolBox.


This article presents a console application that allows to create or delete a ToolBox tab and fill it with components of one or more assemblies. This article extends the Serkan Inci article (although I’ve not started from his code, I’ve found there the trick of activating a Property window).

The generated EXW file can be easily run from any installer, hiding its command window.


Basic familiarity with Visual Studio .NET and C# is necessary for this article. Experience on DTE and Reflection is a plus.

Using the code

To use the EXE file to install a DLL, simply launch:

ElToolBoxInstaller.exe -i TabName FirstDllFullPath 
                   [SecondDllFullPath]  [ThirdDllFullPath] ….

Note that you have to pass the assembly's full path.

To use the EXE file to delete a tab, simply launch:

ElToolBoxInstaller.exe -u TabName

Design specifics are that:

  1. All components of an assembly are going to be installed on the same tab.
  2. With a single command it is possible to install components from multiple assemblies under the same tab.
  3. Visual Studio will be closed during installation (the software checks for this).
  4. All versions of Visual Studio have to be updated.

About point 1, I will probably update the code to allow to send components of the same assembly to different tabs (it wasn’t necessary for my products till now, but I think there’s an easy way of installing all components to a tab and then moving them).

Point 2 is important to avoid reopening a DTE several times.

Point 3 is a limitation that helps to prevent bad results and unnecessary complications (you could easily update code to link an open Visual Studio instance, but you should update the ToolBox of all instances and I’ve found some strange effects when the development environment was in debug mode).

First of all the program checks if a Visual Studio instance is running, looking for a "devenv" process.

private static bool IsVSActive()
    //"Checking if Vs is open"
        Process[] processArray1 = Process.GetProcesses();
        for (int num1 = 0; num1 < processArray1.Length; num1++)
            Process process1 = processArray1[num1];
            if (string.Compare(process1.ProcessName, "devenv", 
                     true, CultureInfo.InvariantCulture) == 0)
                return true;
    catch (Exception e)
    return false;

Once verified that no VS instance is running, the program proceeds.

The higher level function is InstallOnVs, it receives as argument a ProgId string (for example: “VisualStudio.DTE.7.1” for Visual Studio 2003) and an array of strings that must contain:

  1. –i (to install) or –u (to uninstall)
  2. tab name
  3. one or more assembly full paths

InstallOnVs first creates a ToolBox window:

//"Get DTE type"
Type type1 = Type.GetTypeFromProgID(progId);
// Version of VS is not installed 
if (type1 == null) return;
// Create DTE
dte1 = (DTE) Activator.CreateInstance(type1);
// Get ToolBox Window
Window window1 = dte1.Windows.Item(Constants.vsWindowKindToolbox);
box1 = (ToolBox) window1.Object;
private static void tabActivate()
    //Basically a trick to fix some strange behaviour of DTE
    dte1.ExecuteCommand("View.PropertiesWindow", "");
    //"Select first tab item"

Finally all assemblies are loaded using AddtoToolBox.

private static void AddToToolBox(string assemblyfullpath)
        //Check if file exists
        FileInfo info1 = new FileInfo(assemblyfullpath);
        if (info1.Exists)
            tab2.ToolBoxItems.Add(tabName, assemblyfullpath, 
    catch (Exception e)

Although the task is not so complex I wasn’t able to find a “ready to go” solution, I hope now this will save your time.


First version submitted - 07 September 2005.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Roberto Polesel
Web Developer
Italy Italy
Roberto is cofounder of EuclidLabs, a young company developing robotics appications and .Net components.
He has several years of experience in programming industrial applications around the world, both on PC side (C, C++, VB, C#) and CNC side (G code, FANUC and KUKA robot language).
When he is not travelling or programming he is usually involved in quite dangerous activity (boxing and martial arts, parachute, shopping with girlfriend).

If you have a really challenging robotics problem feel free to contact him at

Science may set limits to knowledge, but should not set limits to imagination.
Bertrand Russell

You may also be interested in...


Comments and Discussions

NewsThere is a free tool for do that on VS2005 Pin
www.issoft.eu13-Sep-07 1:13
memberwww.issoft.eu13-Sep-07 1:13 
GeneralI need this for .NET 2005 Pin
Pink Floyd8-Mar-06 9:16
memberPink Floyd8-Mar-06 9:16 
GeneralRe: I need this for .NET 2005 Pin
Pink Floyd10-Mar-06 7:52
memberPink Floyd10-Mar-06 7:52 
GeneralSuggestion for future versions Pin
yjj11-Oct-05 4:56
memberyjj11-Oct-05 4:56 
GeneralRe: Suggestion for future versions Pin
Roberto Polesel21-Oct-05 4:25
sussRoberto Polesel21-Oct-05 4:25 

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 | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 20 Sep 2005
Article Copyright 2005 by Roberto Polesel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid