Commands Element


This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Represents the collection of commands on the VSPackage toolbar. The collection can have up to five subsections, as follows: menus, groups, buttons, combos, and bitmaps.

Each subsection child element, for example, <Menu>, is identified by a unique command ID that is a GUID and numeric identifier pair. The GUID identifies the "command set" and is used to group logically related commands. The VSPackage should define its own command set to avoid collisions with command IDs that are defined by other VSPackages.


<Commands package="GuidMyPackage" >  
  <Menus>... </Menus>  
  <Groups>... </Groups>  
  <Buttons>... </Buttons>  
  <Combos>... </Combos>  
  <Bitmaps>... </Bitmaps>  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.


Attribute Description
package A GUID that identifies the VSPackage that provides the commands.

For example, package="guidVsPackage1Pkg".

Child Elements

Element Description
Menus Element Defines all the menus that a VSPackage implements.
Groups Element Contains entries that define the command groups in a VSPackage.
Buttons Element Groups Button elements.
Bitmaps Element Groups Bitmap elements.
Combos Element Groups Combo elements.

Parent Elements

Element Description
CommandTable Element Defines all the elements that represent the commands that a VSPackage provides to the IDE. Possible elements are menu items, menus, toolbars, and combo boxes.


The following example shows how to use a Commands Element.

<Commands package="guidMyPackage">  
      <Menu Condition="'%(DEBUG)' != 'true'"   
        guid="cmdSetGuidMyProductCommands" id="menuIDMainMenu"   
        priority="0x0000" type="Menu">  
          <Documentation>this is an annotation</Documentation>  
              <CustomSubElement>Some data</CustomSubElement>  

See Also

How VSPackages Add User Interface Elements
Commands, Menus, and Toolbars