Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 220
Matthias Avatar asked Sep 18 '12 18:09

Matthias


1 Answers

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.

like image 116
Simon Mourier Avatar answered Oct 21 '22 06:10

Simon Mourier