简体   繁体   English

在visual studio扩展中放置菜单选项

[英]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). 我的Visual Studio 2010扩展程序有一个新的菜单选项(使用Package SDK,.vsix制作)。 I'd like it to appear just after the Attach to Process options, preferably in the same menu group. 我希望它出现在Attach to Process选项之后,最好是在同一个菜单组中。 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; .vsct声明XML中还有一个priority属性; 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? 如果是这样,我在哪里可以找到现有Visual Studio菜单选项的优先级?

Got an answer on the Visual Studio forums . 在Visual Studio论坛上得到了答案。 The steps as I understand them: 我理解的步骤如下:

  1. Turn EnableVSIPLogging on and use that to query the menu option. 打开EnableVSIPLogging并使用它来查询菜单选项。 Enable the registry value and hold Ctrl+Shift and click the menu option. 启用注册表值并按住Ctrl + Shift并单击菜单选项。 The output will give you a CmdID. 输出将为您提供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. 在Program Files \\ Microsoft Visual Studio 2010 SDK SP1 \\ VisualStudioIntegration \\ Common \\ Inc \\ stdidcmd.h中搜索该ID以获取友好的命令ID。 In my case this was cmdidToolsDebugProcesses. 在我的例子中,这是cmdidToolsDebugProcesses。
  3. Then you can search on cmdidToolsDebugProcesses in the Inc folder and get the CommandPlacement for it. 然后,您可以搜索Inc文件夹中的cmdidToolsDebugProcesses并获取它的CommandPlacement。 That will tell you the parent GUID group name and ID, as well as the priority (which determines ordering from top to bottom). 这将告诉您父GUID组名称和ID,以及优先级(它决定从上到下的排序)。
  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. 现在,您需要在包中搜索这些GUID名称以获取它们的值,然后在包的.vsct文件中声明它们。
  5. Now you can attach to the same parent and set the priority appropriately relative to the siblings in the group. 现在,您可以附加到同一父级,并相对于组中的兄弟级别适当地设置优先级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM