Friday, September 07, 2007

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. 


Comments:
I found a lot of worthwhile info here!
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?