VsixCommunity / Community.VisualStudio.VSCT

Community toolkit for VSCT files used in Visual Studio extensions
Other
12 stars 4 forks source link

Provide alternative to IDG_VS_MM_TOOLSADDINS #7

Open xEsteem opened 2 years ago

xEsteem commented 2 years ago

I'm using 16.0.29.6 in Visual Studio 2019 and i can't seem to find an alternative to IDG_VS_MM_TOOLSADDINS which is the id for the group in the "Extensions" menu that other extension submenus tend to appear under. This is the top group in the extensions menu above the default group.

All i can find is the "Extensions" menu itself (VsMainMenu -> Extensions) and the "Extensions.DefaultGroup" menu which is the group below that which i am referring to, that contains "manage extensions" etc.

CZEMacLeod commented 2 years ago

Using the tools->addins menu I think is kind of a deprecated approach now. I think the best approach now is to create your own group for all your commands under VsMainMenu -> Extensions and add all your menu items to that. If you want the menu group to appear before the manage extensions group, give it a priority like 0x0000. If you want it below the manage extensions group, use something like 0x0600.

Based off the default community template for project with command, the following gave me what I think you are looking for.

  <Commands package="VSIXProject1">
    <Groups>
      <Group guid="VSIXProject1" id="MyMenuGroup" priority="0x0000">
        <Parent guid="VSMainMenu" id="Extensions"/>
      </Group>
    </Groups>

    <!--This section defines the elements the user can interact with, like a menu command or a button
        or combo box in a toolbar. -->
    <Buttons>
      <Button guid="VSIXProject1" id="MyCommand" priority="0x0100" type="Button">
        <Parent guid="VSIXProject1" id="MyMenuGroup" />
        <Icon guid="ImageCatalogGuid" id="StatusInformation" />
        <CommandFlag>IconIsMoniker</CommandFlag>
        <Strings>
          <ButtonText>My Command 2</ButtonText>
          <LocCanonicalName>.VSIXProject1.MyCommand</LocCanonicalName>
        </Strings>
      </Button>
    </Buttons>
  </Commands>

  <Symbols>
    <GuidSymbol name="VSIXProject1" value="{96e88d23-7d8a-44f8-98e4-490dad877c07}">
      <IDSymbol name="MyMenuGroup" value="0x0001" />
      <IDSymbol name="MyCommand" value="0x0100" />
    </GuidSymbol>
  </Symbols>