How to add commands to Visual Studio 2012?
Asked Answered
M

1

9

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.

Major answered 18/9, 2012 at 18:11 Comment(5)
What about stackoverflow.com/tags/vsx/info?Newly
@JohnSaunders: what do you mean?Major
Sorry, I thought there were some links there. I'll have to add some.Newly
As of 2010, see #1147276. There isn't that much different in this area in 2012.Newly
@JohnSaunders: Thanks for the link. I already managed to add a menu entry. Nevertheless, I couldn't find any appropriate way to add ONLY a command. Notice that this is just to migrate some macros (VS2010) to a vsx package (VS2012), because VS2012 doesn't support macros any longer. I don't want to waste much time on this, so it would be very kind, if someone could point me to a good blog post or something.Major
M
4

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.

Moria answered 23/9, 2012 at 8:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.