Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

vsx - How to add commands to Visual Studio 2012?

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.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...