.netvisual-studio-2010vsx

Placing menu options in visual studio extensions


I've got a new menu option for my Visual Studio 2010 extension (made with the Package SDK, .vsix). I'd like it to appear just after the Attach to Process options, preferably in the same menu group. There's documentation on the existing menu groups but that doesn't seem to include the groups I'm looking for.

There's also a priority attribute in the .vsct declaration XML; does that control the ordering of the menu options and groups? If so, where can I find the priority of existing Visual Studio menu options?


Solution

  • Got an answer on the Visual Studio forums. The steps as I understand them:

    1. Turn EnableVSIPLogging on and use that to query the menu option. Enable the registry value and hold Ctrl+Shift and click the menu option. The output will give you a CmdID.
    2. Search for that ID in Program Files\Microsoft Visual Studio 2010 SDK SP1\VisualStudioIntegration\Common\Inc\stdidcmd.h to get the friendly command ID. In my case this was cmdidToolsDebugProcesses.
    3. Then you can search on cmdidToolsDebugProcesses in the Inc folder and get the CommandPlacement for it. That will tell you the parent GUID group name and ID, as well as the priority (which determines ordering from top to bottom).
    4. Now you need to search for those GUID names in the includes to get the values for them, then declare those in your package's .vsct file.
    5. Now you can attach to the same parent and set the priority appropriately relative to the siblings in the group.