Create a new top-level menu in Visual Studio

We have an add-on for VS, which is currently launched from the tool menu, the add-in consists of aa UI, offering the user several options buttons, which I now want to convert to a top-level menu that will offer the same functionality.

I read this tutorial, which helped me add a new top-level menu, but could not understand the logic of all the steps. The manual does not completely understand what each of the steps creates or how it can change your result.
Creating Steps is a new top-level menu with one item below it. I am trying to create some hierarchy in my menu (i.e. Top Level → Subcategory → Commands), but lost it with the whole structure of groups / menus / identifiers. Is there a clear explanation of the structure of these files? Documentation or tutorial? If someone had experience in this subject and he could help to figure it out, I would really appreciate him ...

+4
source share
2 answers

I did not try to make hierarchical menu items, but I had similar problems with the Visual SDK.vcst file. It is a pain. A few things you can do.

+1
source

Code example

<?xml version="1.0" encoding="utf-8"?> <CommandTable xmlns="..."> <!-- Extern section unchanged --> <Commands package="guidHowToPackagePkg"> <Menus> <!-- New menu added --> <Menu guid="guidBasicVSCTSampleCmdSet" id="SubMenu" priority="0x200" type="Menu"> <Parent guid="guidBasicVSCTSampleCmdSet" id="TopLevelMenuGroup" /> <Strings> <ButtonText>Other Commands</ButtonText> <CommandName>Other Commands</CommandName> </Strings> </Menu> </Menus> <Groups> <!-- Group changed to SubMenuGroup and attached to SubMenu --> <Group guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup" priority="0x0600"> <Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenu"/> </Group> </Groups> <Buttons> <!-- We attached these two buttons to SubMenuGroup --> <Button guid="guidBasicVSCTSampleCmdSet" id="ThirdCommand" priority="0x0100" type="Button"> <Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup" /> <Icon guid="guidImages" id="bmpPicX" /> <Strings> <CommandName>ThirdCommand</CommandName> <ButtonText>Third Command</ButtonText> </Strings> </Button> <Button guid="guidBasicVSCTSampleCmdSet" id="FourthCommand" priority="0x0101" type="Button"> <Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup" /> <Icon guid="guidImages" id="bmpPicArrows" /> <Strings> <CommandName>FourthCommand</CommandName> <ButtonText>Fourth Command</ButtonText> </Strings> </Button> </Buttons> </Commands> <Symbols> <!-- We add a SubMenu and changed SubMenuGroup --> <GuidSymbol name="guidBasicVSCTSampleCmdSet" value="..."> <IDSymbol name="SubMenu" value="0x0101" /> <IDSymbol name="SubMenuGroup" value="0x0201" /> </GuidSymbol> </Symbols> </CommandTable> 

This gives you the following top level menu:

enter image description here

Here is a complete chapter on this topic. This largely explains everything you need to know in the (hierarchical) menu.

http://dotneteers.net/blogs/divedeeper/archive/2010/05/23/vs-2010-package-development-chapter-2-commands-menus-and-toolbars.aspx

-1
source

All Articles