Commands Element

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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>  
</Commands>  

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

Attributes

AttributeDescription
packageA GUID that identifies the VSPackage that provides the commands.

For example, package="guidVsPackage1Pkg".

Child Elements

ElementDescription
Menus ElementDefines all the menus that a VSPackage implements.
Groups ElementContains entries that define the command groups in a VSPackage.
Buttons ElementGroups Button elements.
Bitmaps ElementGroups Bitmap elements.
Combos ElementGroups Combo elements.

Parent Elements

ElementDescription
CommandTable ElementDefines 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">  
    <Menus>  
      <Menu Condition="'%(DEBUG)' != 'true'"   
        guid="cmdSetGuidMyProductCommands" id="menuIDMainMenu"   
        priority="0x0000" type="Menu">  
        <Annotation>  
          <Documentation>this is an annotation</Documentation>  
          <AppInfo>  
            <CustomData>  
              <CustomSubElement>Some data</CustomSubElement>  
            </CustomData>  
          </AppInfo>  
        </Annotation>  
        <CommandFlag>AlwaysCreate</CommandFlag>  
        <Strings>  
          <ButtonText>MainMenu</ButtonText>  
        </Strings>  
      </Menu>  
  </Menus>  
<Commands>  

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

Show: