Answered Install custom control to toolbox in VS2010

  • Monday, April 16, 2012 7:15 AM
     
     

    Hi,

    I have defined a custom control in C# and I have created the vsi file for installing it in the toolbox of VS2010. The vsi file works well but installs the control in a generic tab "My Controls", is it possible to specify in which tab to visualise the control? And if it possible, how can I create a new tab in the toolbox without adding it manually?

    Thank you in advance for any advice or help.

All Replies

  • Tuesday, April 17, 2012 9:48 AM
    Moderator
     
     

    Hi namale,

    After we have located a control that has been packaged as a .vsi file, we can easily install the control for use in Visual Studio.

    To install a custom control packaged in a .vsi file

    1. Double-click the .vsi file.

    The Visual Studio Content Installer appears.

    1. On the Select Content to Install page, select the items that you want to install and then click Next. If the component is not signed, a warning might appear.
    2. On the Content Installation page, click Finish to install the control.

    If Visual Studio is not currently open, the installer will open and then close Visual Studio during the installation process.

    1. Click Close to exit the installer.

    The control will appear in the My Controls section of the Toolbox.

    More information: http://msdn.microsoft.com/en-us/library/ms165358.aspx


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

  • Wednesday, April 18, 2012 2:13 AM
    Moderator
     
     Answered Has Code

    A better solution for VS 2010, is to use the project template that allows you to build and deploy your control with a .VSIX file. The VSI stuff is pretty dated, and the VSIX deployment is much simpler to set up.

    If you create a new project using the "Windows Forms Toolbox Control" project template, or the "WPF Toolbox Control" project template, you'll notice that there is a ProvideToolboxControl atttribute applied to your control class. This attribute takes a string that names the group the control is installed under. For example:

      
        [ProvideToolboxControl("MyControls"false)]
    

    When you build the project, a .PKGDEF file is created with the necessary registry settings that will tell the VS toolbox service about your control. All you need to do is install the .VSIX file. It'll deploy your contol, and register it with the toolbox.

    See the following for details:

    Walkthrough: Creating a Windows Forms Toolbox Control
    Walkthrough: Creating a WPF Toolbox Control
    Walkthrough: Publishing a Custom Web Control

    Sincerely,


    Ed Dore