How to add commands to Visual Studio 2012?

别说谁变了你拦得住时间么 提交于 2019-11-28 03:44:17

问题


How can I add custom commands to the keyboard dialog (Tools->Options->Keyboard) in order to trigger them by shortcuts? Unfortunately, I could not find any resource on the web.

I crossed this blog post, but it's slightly different, because I'd have to create a menu entry. I only want to show the commands in the keyboard dialog. Just like it worked with macros.


回答1:


I have not checked VS 2012 in this area, but I think it's the same as for previous version.

All that menu and command stuff is localized in a file called [mypackage].vsct which is the Visual Studio Command Table. The schema is described here: VSCT XML Schema Reference. When you used the wizard it probably created one for you.

As you can see in the schema, a Command is always linked somehow to a Menu (Commands Element), but there are a number of flags you can use to tweak this: Command Flag Element. Depending on what you do, I'd try the CommandWellOnly, DefaultInvisible and DynamicVisibility.

Anyway, if you don't want your menu to appear on the top menu bar, just can also just change the <Parent> element of the root <Menu> element in the vsct file.



来源:https://stackoverflow.com/questions/12482620/how-to-add-commands-to-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!