Does anyone know the VSSDK id for the 'Add' submenu group within the Solution Context Menu?

402 Views Asked by At

I'm looking to add a new button to the following sub menu group from within the Solution Context Menu in VS 2019 (see red arrow for intended location):

Intended location of new button

The closest I've managed so far is beneath the 'Add' dropdown button in the main menu using the id IDG_VS_CTXT_SOLUTION_ADD. I've tried the following parent ids to no avail (doesn't even appear):

IDG_VS_CTXT_SLNFLDR_ADD; IDM_VS_CSCD_SOLUTION_ADD

Does anyone know the Id I need to use or the changes I need to make to my VSCT file to get the button to appear where I want it to? I've used the Mads Extensibility extension and browsed many vsct files looking for a clue but without luck.

Here's my command declaration from my package vsct file:

<Buttons>
 <Button guid="guidNewCommand1CmdSet" id="NewCommandId" priority="0x0100" type="Button">
    <Parent guid="guidSHLMainMenu" id="<PARENT_ID_NEEDED_HERE>" />
    <CommandFlag>DynamicVisibility</CommandFlag>
    <Strings>
      <CommandName>MyNewCommand</CommandName>
      <ButtonText>Test New Command</ButtonText>
    </Strings>
  </Button>
</Buttons>
1

There are 1 best solutions below

1
On

In order to include a new option in Visual Studio context menu, you need to set the parent of the new command to:

  • IDM_VS_CTXT_SOLNNODE - for solution
  • IDM_VS_CTXT_PROJNODE - for project
  • IDM_VS_CTXT_FOLDERNODE - for folder
  • IDM_VS_CTXT_ITEMNODE - for file (the object type is actually ProjectItem)
  • IDM_VS_CTXT_EZDOCWINTAB - for file tab editor (right click on the active document tab from the editor)

I personally use these values in multiple Visual Studio extensions. They are compatible with: VS2015, VS2017 and VS2019