Commands.AddCommandBar Method (String, vsCommandBarType, Object, Int32)
Creates a command bar that is saved and available the next time the environment is started.
Assembly: EnvDTE (in EnvDTE.dll)
object AddCommandBar( string Name, vsCommandBarType Type, object CommandBarParent, int Position = 1 )
Required. A name for the new command bar.
Required. A vsCommandBarType constant that determines the type of command bar:
- Type: System.Object
Optional. The index position, starting at one, in the command bar to place the new command bar.
The CommandBar object is a member of the Microsoft Office object model.
The command bar added with this method is a permanent command bar, which is available in every session of the IDE whether or not the VSPackage is loaded. You should use this method to add a command bar only if you want a permanent command bar. You should call this method only once, when your VSPackage is loaded for the first time. If you want a temporary command bar, which appears only when the VSPackage is actually loaded, you must use the DTE.CommandBars.Add method when you load the VSPackage, and then call DTE.CommandBars.Remove method when it is unloaded.
Since a permanent command bar appears even when the VSPackage is not loaded, you should be sure to remove it when the VSPackage is uninstalled. Therefore, you must use an MSI to install and uninstall your VSPackage, and add a custom action to your uninstall program.
For more information about menus and commands, see Commands, Menus, and Toolbars.