Welcome to MSDN Blogs Sign in | Join | Help

Installing Managed ToolBox Controls Programmatically

In the past with Visual Studio 2003, it was possible to programmatically add .Net or Managed toolbox controls using the DTE. With Visual Studio 2005 this method of programmatically adding the controls has been deprecated in favor of using one of the following two methods:

1. Visual Studio Content Installer
2. Tools.InstallCommunityControls command.

The difference between the two is that one is an external program that can install all kinds of community content such as addins, macros, snippets etc and the other is a built in command.

Using Visual Studio Content Installer
This executable, VSContentInstaller.exe, is available under \Program Files\Common Files\Microsoft Shared\MSEnv. The input for this executable is a VSI file. More information on this is available here: http://msdn2.microsoft.com/en-us/library/ms246580.aspx

Using the Tools.InstallCommunityControls command
You can use this command to add custom toolbox controls either from within Visual Studio or from the command line. For either case you need to follow the steps outlined below to install the controls.
Copy the controls to the My Documents\Visual Studio 2005\Controls\<companyname>\ folder. The <companyname> is used as the name of the tab which will contain controls.

For command line installation:
Open the Visual Studio Command prompt and execute the following command:
devenv /command Tools.InstallCommunityControls

For installation from within Visual Studio:
Open the Command Window (View->Other Windows->Command Window) and execute the following command: Tools.InstallCommunityControls.

Having the ability to execute a command from the command line can be very useful in creating install scripts and a batch file such as the one below can install the community controls.

@echo off
set TabName=%1
set DllName="%2"
set ControlsFolder="%userprofile%\My Documents\Visual Studio 2005\Controls\%TabName%"
%ControlsFolder%
mkdir %ControlsFolder%
copy %DllName% %ControlsFolder%
"%VS80COMNTOOLS%\..\IDE\devenv.exe" /command Tools.InstallCommunityControls
set TabName=
set DllName=
set ControlsFolder=

Another way to do this using DTE is to use DTE.ExecuteCommand:


DTE2 dte;
dte = (DTE2)Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.DTE.8.0"));
dte.ExecuteCommand("Tools.InstallCommunityControls", "");
dte.Quit();

One thing to note is that this mechanism does not fit well if you have folder redirection and some more work in terms of setting right permissions etc is required.

 

Published Wednesday, October 05, 2005 12:52 AM by ChetanC

Comments

Wednesday, October 05, 2005 12:50 AM by Robert McLaws

# re: Installing Managed ToolBox Controls Programmatically

How would you install add-ins using the VS Content Installer?
Wednesday, October 05, 2005 11:04 AM by jbabco

# re: Installing Managed ToolBox Controls Programmatically

The documentation around the .vscontent file for installing toolbox items is very light. Can you provide (or point to) a sample .vscontent file that demonstrates this?

Also, I tried the Tools.InstallCommunityControls method with RTM 50727 and it didn't install my components/folder.
Monday, October 10, 2005 1:38 AM by ChetanC

# re: Installing Managed ToolBox Controls Programmatically

For sample content files, see my last post.
Sunday, August 19, 2007 4:58 PM by issoft

# re: Installing Managed ToolBox Controls Programmatically

We have developed a free tool avaliable at www.issoft.eu called "Component Installer" that is pretty simple to use.

It can create tabs and add selected controls and components to the tooltab, delete them and some other usefull stuff.

Just to let you know.

Monday, March 10, 2008 9:09 PM by 死刑犯

# 一种向VS2005环境自动注册控件的方法的详细过程以及注意事项。

一种向VS2005环境自动注册控件的方法的详细过程以及注意事项。

Monday, March 10, 2008 9:09 PM by 死刑犯

# VS2005自动注册控件方法一

一种向VS2005环境自动注册控件的方法的详细过程以及注意事项。

Friday, January 23, 2009 12:30 AM by Estendere controllo Panel | hilpers

# Estendere controllo Panel | hilpers

Anonymous comments are disabled
 
Page view tracker