Once an Add-in is created, it must be registered as a COM component with Microsoft Windows. The Add-in Wizard automatically performs this registration for you, but if you do not use the Add-in Wizard to create the Add-in, you must do it manually by following the steps below:
To register a .NET Framework component
- Open a command prompt window.
- If you are using Visual Basic .NET or Visual C# .NET, enter
<name>is the name of the Add-in. If you are using Visual C++ .NET, use regsvr32.
After an Add-in is registered, it is recognized by the integrated development environment (IDE). To list it in the Add-In Manager dialog box, you must create registry keys for it, as outlined below.
In some cases, it is useful to know what registry keys are affected by the Add-In Wizard. The Add-In Wizard creates a unique programmatic ID (progID) for each Add-in and inserts it into the registry. A progID consists of the name of the project followed by a period and the name of the class module, such as
Visual Studio stores this registry information in the following keys:
HKEY_CURRENT_USER Software Microsoft VisualStudio 7.1 Addins ProgID1 ProgID2
HKEY_CURRENT_USER is used to make the add-in available to only the current user. To make it available to all users, use
Each ProgID contains the following name/value pairs:
- FriendlyName – Optional. The name that appears in the Add-in Manager's Available Add-Ins list. This value is optional, but it is highly recommended that you use it.
- Description – Optional. A string that displays at the bottom of the Add-in Manager dialog box when the Add-in is selected. This value is optional, but it is highly recommended that you use it.
- LoadBehavior – Optional. A DWORD bit field with the following flags (for Visual Studio, Visual Basic, and VSA). These values are optional, but it is highly recommended that you use them.
Flags Value Description ID_UNLOADED 0 The Add-in is not loaded right now. ID_STARTUP 1 The Add-in should be loaded at IDE startup. ID_COMMAND_LINE 4 The Add-in should be loaded when devenv is invoked from the command line with a build switch.
- CommandPreload – Optional. A Boolean value that indicates whether it is the first time that Visual Studio has started since the Add-in was registered. This flag allows you, for example, to specify that an Add-in is loaded once quietly so that it can place commands in the menus, and then it is immediately unloaded until an end-user uses one of the commands, which then demand-loads the Add-in in all successive instances of the IDE.
Value Description 0 Specifies that the add-in has set up its commands. 1 Specifies that the add-in still needs to setup its commands.
You can check the OnConnection method you implement to see if the type of connection is ext_cm_UISetup. If it is, you can perform whatever command placements you want using the AddNamedCommand
- CommandLineSafe - Optional. Indicates whether the Add-in was designed to avoid displaying a UI when invoked by the devenv command line.
- SatelliteDllPath and SatelliteDllName – Optional. The name and description entries in the registry can be localized. If their values begin with a pound sign (#) immediately followed by a parseable integer, then the string value displayed in the Add-in Manager is the value of this specified resource ID in the satellite DLL. The satellite DLL is determined by one or two additional registry entries:
- SatelliteDllPath – If present, the value is a string that is a full pathname to a directory, ending in a backslash (\) character. The Add-in Manager looks for the satellite DLL in a location determined by the concatenation of SatelliteDllPath, the locale ID of the installed machine, the backslash, and SatelliteDllName.
- SatelliteDllName - The value is a string that names a file. The directory containing the file is either the directory containing the DLL that manifests the Add-in, or it is the computed directory described for SatelliteDllPath.
The satellite DLL search algorithm is to take the prefix directory and the file name, then start a search in the following order:
- Look for <BasePath>\shell UI locale\<DLLName>
- If failed, look for <BasePath>\User's preferred OS Locale\<DLLName>
- If failed, look for <BasePath>\User's setup OS Locale\<DLLName>
- If failed, look for <BasePath>\1033\<DLLName>
- If failed, look for <BasePath>\<DLLName>