user3487852
user3487852

Reputation:

VSIX/VSPackage: Solution Control Explorer context menu

I am having a lot of issues trying to understand how to get a submenu working in VisualStudio 2013's Solution Control Explorer, when creating a VSPackage project. I am able to add buttons, and that is great. However, I want to create the submenus such as the existing "Find" and "Advanced": Example Image

The code below is getting the two buttons in the menu list (as seen in the image/link above), but it does not show the submenu. I have tried to add buttons to the submenu, but it still does not show.

<Commands package="guidFirstPackagePkg">
    <Menus>
      <Menu guid="guidVSPackage3CmdSet" id="SubMenu" priority="0x0100" type="Menu">
          <Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId"/>
          <Strings>
              <ButtonText>Sub Menu</ButtonText>
              <CommandName>Sub Menu</CommandName>
          </Strings>
      </Menu>
    </Menus>

    <!--Buttons section. -->
    <Buttons>
      <Button guid="guidVSPackage2CmdSet" id="cmdIdImport" priority="0x0100" type="Button">
        <Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId" />
        <Strings>
          <ButtonText>Import</ButtonText>
        </Strings>
      </Button>
      <Button guid="guidVSPackage2CmdSet" id="cmdIdExport" priority="0x0100" type="Button">
        <Parent guid="guidSourceControlExplorerMenuGroup" id="SourceControlExplorerMenuGroupId" />
        <Strings>
          <ButtonText>Export</ButtonText>
        </Strings>
      </Button>
  </Buttons>
</Commands>

<Symbols>
    <!-- This is the package guid. -->
    <GuidSymbol name="guidFirstPackagePkg" value="{fd27b3da-39c0-486a-9900-652cb81b0744}" />

    <GuidSymbol name="guidSourceControlExplorerMenuGroup" value="{ffe1131c-8ea1-4d05-9728-34ad4611bda9}">
      <IDSymbol name="SourceControlExplorerMenuGroupId" value="0x1111" />
    </GuidSymbol>

    <GuidSymbol name="guidVSPackage2CmdSet" value="{1d975044-0a78-4e91-a6c2-2e841f4280e4}">
      <IDSymbol name="cmdIdImport" value="0x0100" />
      <IDSymbol name="cmdIdExport" value="0x0110" />
    </GuidSymbol>

    <GuidSymbol name="guidVSPackage3CmdSet" value="{C860DEF0-0A00-44BE-A8D9-393BACE1A44A}">
      <IDSymbol name="SubMenu" value="0x1001"/>
    </GuidSymbol>
</Symbols>

Any ideas of what I am doing wrong? Wrong linking, can I not use the same "SourceControlExplorerMenuGroupId" for menus, but only buttons?


I know a related post dealt with the addition of a button to the Solution Control Explorer, however, I was unable to replicated this for a Solution Control Explorer submenu: Creating VSIX package for TFS Source control explorer context menu extension

Another reference I tried, but was not related to Solution Control Explorer: Why isn't my vspackage's context menu showing

Upvotes: 0

Views: 702

Answers (1)

Anthony DiVanna
Anthony DiVanna

Reputation: 1

Your <Menus> code is fine.

Create a group with its parent guid and id matching your menu guid and id:

<Groups>
    <Group guid="guidVSPackage3CmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidVSPackage3CmdSet" id="SubMenu" />
    </Group>
</Groups>

Then, just have your buttons be children of the group:

<Buttons>
      <Button guid="guidVSPackage2CmdSet" id="cmdIdImport" priority="0x0100" type="Button">
        <Parent guid="guidVSPackage3CmdSet" id="MyMenuGroup" />
        <Strings>
          <ButtonText>Import</ButtonText>
        </Strings>
      </Button>
      <Button guid="guidVSPackage2CmdSet" id="cmdIdExport" priority="0x0100" type="Button">
        <Parent guid="guidVSPackage3CmdSet" id="MyMenuGroup" />
        <Strings>
          <ButtonText>Export</ButtonText>
        </Strings>
      </Button>
  </Buttons>

Upvotes: 0

Related Questions