Registering Interop Assembly Command Handlers
A VSPackage must register with Visual Studio so that the integrated development environment (IDE) routes its commands properly.
The registry can be updated either by manual editing or by using a Registrar (.rgs) file. For more information, see Creating Registrar Scripts.
The Managed Package Framework (MPF) provides this functionality through the ProvideMenuResourceAttribute class.
Command Table Format Reference resources are located in unmanaged satellite UI dlls.
Command Handler Registration of a VSPackage
A VSPackage acting as a handler for user interface (UI)-based commands requires a registry entry named after the VSPackage GUID. This registry entry specifies the location of the VSPackage's UI resource file and the menu resource within that file. The registry entry itself is located under HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\<Version>\Menus, where <Version> is the version of Visual Studio, for example 9.0.
Note
The root path of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio<Version> can be overridden with an alternate root when the Visual Studio shell is initialized. For more information about the root path, see Installing VSPackages By Using Windows Installer.
The CTMENU Resource Registry Entry
The structure of the registry entry is:
HKEY_LOCAL_MACHINE\Software\VisualStudio\<Version>\
Menus\
<GUID> = <Resource Information>
<GUID> is the GUID of the VSPackage in the form {XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX}.
<Resource Information> consists of three elements separated by commas. These elements are, in order:
<Path to Resource DLL>, <Menu Resource ID>, <Menu Version>
The following table describes the fields of <Resource Information>.
Example
Here is an example of a couple of resource entries:
HKEY_LOCAL_MACHINE\Software\VisualStudio\9.0Exp\
Menus\
{019971D6-4685-11D2-B48A-0000F87572EB} = ,1, 10
{1b027a40-8f43-11d0-8d11-00a0c91bc942} = , 10211, 3
See Also
Concepts
How VSPackages Add User Interface Elements to the IDE