1

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>
benjones
  • 31
  • 4
  • 2
    You can install this https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityEssentials2019 that has a lot of tools, or just this one https://marketplace.visualstudio.com/items?itemName=MadsKristensen.CommandExplorer to explore commands – Simon Mourier Jan 30 '20 at 08:47
  • Thanks Simon - but that's exactly what I did (which got me as far as the IDG_VS_CTXT_SOLUTION_ADD part), but nothing is reported for the sub menu group. – benjones Jan 31 '20 at 15:11

1 Answers1

2

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

Ionut Enache
  • 461
  • 8
  • 22
  • Thanks Ionut. I tried out the SOLNNODE one but nothing came up in the group I'm targeting. In fact, I didn't see any menu option in any area of the Solution context menu. Might I be missing anything else from my VSCT file? – benjones Feb 06 '20 at 08:03