Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to create a Visual Studio 2017 extension, just for fun and to learn how VS extensibility works.

My extension must be usable from the Solution Explorer tab as a context menu button, but I would like to include it at a menu level that isn't root.

My goal is to put it in the "Add" sub-menu, but at the moment I'm only able to put it at root level (when you right-click the Project item, the menu entry is shown as the last of the context menu control).

How can I move it under the "Add" node?
Can it be done from the CommandPlacement tags I have configured in my .vsct file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
574 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use as parent of your command the IDG_VS_CTXT_PROJECT_ADD_ITEMS group id. If you are using CommandPlacement it would be:

  <CommandPlacement guid="..." id="..." priority="0x0001" >
     <Parent guid="guidSHLMainMenu" id="IDG_VS_CTXT_PROJECT_ADD_ITEMS"/>
  </CommandPlacement>

Remember:

  • The parent of a group can be another group, a menu, a toolbar, a context menu, etc. either created by your extension or an existing one of VS, identified by prefix "IDM_". See GUIDs and IDs of Visual Studio menus and GUIDs and IDs of Visual Studio toolbars.
  • The parent of a command is always a group, never a menu, context menu or toolbar. The group can be new (created by your extension) or an existing group of Visual Studio, identified by prefix "IDG_". You have some built-in Visual Studio groups in the links above, but for a more exhaustive list install the ExtensionTools extension (Mads Kristensen) that provides intellisense in the .vsct file or check the source code of its VsctBuiltInCache.cs file.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...