TCI - Toolbox Controls Installer

 

TCI is a VS Package that is provided by the VS SDK as a redist. TCI allows you to easily add your custom Control to the VS Toolbox. For a brief introduction to TCI you can check the VS SDK documentation. Here I will try to cover what is happening under cover:

When you want to add your custom control to the VS toolbox using the TCI VS Package all you need is to tell TCI where the assembly containing the control is and notify to TCI this event incrementing a registry key. Probably the easier way to achieve these requirements is using a WIX-based installer (as the SDK sample does).

In order to tell TCI where your control is you can use the the fully qualified type name if you are installing the control in the GAC as following:

<Registry Root="HKLM" Key="Software\Microsoft\VisualStudio\9.0\ToolboxControlsInstaller\GacControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1631b3e7a8fbcce5, processorArchitecture=MSIL" Value="Litware Controls" Type="string" />

Or provide a location where the assembly containing the control is using the CodeBase value:

<Registry Root="HKLM" Key="Software\Microsoft\VisualStudio\9.0\ToolboxControlsInstaller\NonGacControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1631b3e7a8fbcce5, processorArchitecture=MSIL" Value="Litware Controls" Type="string">
<Registry Name="Codebase" Value="[#AssemblyContainingTheFile.dll]" Type="string" />
</Registry>

Finally you have to include the MSM containing the custom actions which notify TCI that a new Control has been installed:

<Merge Id="TbxCtrlsInstDefaultItemsCA" Language="1033" SourceFile="..\..\..\Redistributables\TbxCtrlsInstDefaultItemsCA.msm" DiskId="1" />

The custom action will increment or decrement the "Default Items" value of the following registry entry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{2c298b35-07da-45f1-96a3-be55d91c8d7a}\Toolbox]
"Default Items"=dword:00000001

Note that the {2c298b35-07da-45f1-96a3-be55d91c8d7a} is the GUID for the TCI VS Package.

It's important to check if the TCI Redist is already installed before installing your custom controls if you targeting VS 2500. It's not necessary for VS codename "Orcas" because TCI Package is already installed. You can find the TCI VS Package in the VS's Private Assemblies directory. 

5 Comments

  • Any samples on using TCI programmatically? Means, we dont want to do the the toolbox installation at install level.

    A simple sample that show how to use TCI such as from a Winform application (through a simple button click) will be great.

    Regards,
    James.

  • Great post.

    Can one elaborate on how the registry conter is used within VS? Or what is the counter meaning.

    SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{2c298b35-07da-45f1-96a3-be55d91c8d7a}\Toolbox

    Do we need to invoke increment dll for each dll we add to the toolbox or just once to signal a change to the toolbox?

    Ex: Two dlls to add to toolbox (each contain many WPF controls). What should be the final counter value result? ++1 or ++2 or ++NumberOfControlsToAdd?

  • Tci toolbox controls installer.. Tiptop :)

  • Tci toolbox controls installer.. Awesome :)

  • Tci toolbox controls installer.. Peachy :)

Comments have been disabled for this content.