简体   繁体   中英

Add item to Visual Studio source control context menu

I would like to create an extension for VS Source Control Explorer context menu, In order to add an option on the Text Editor context menu I know you need to set IDM_VS_CTXT_CODEWIN on Group's Parent node into the vsct file.

Can someone tell me the correct value for Source Control Explorer context menu?

I don't think that particular context menu guid:id pair is published anywhere. I usually try searching the various .VSCT files under the ….VSSDK\\VisualStudioIntegration\\Common\\Inc directory to find a unique menu item in the context menu, figure out what menu group it's parented to, and work back from there.

But given the thousands of commands and menus wired into the IDE, this can be a hit or miss scenario.

When a search of the various .VSCT files on the above mentioned path doesn't pan out, I usually revert to using the EnableVSIPLogging registry key, to discover the guid:id pair for the given context menu.

Easiest way to set this is to install Mad's Extensibility Tools extension , which adds an "Enable VSIP Logging" command on the IDE's main "View" menu. Once you set this, if you hold down the CTRL+SHIFT keys, while right clicking in the Toolwindow, you'll get a diagnostic message box, with the guid and id of the context menu. You can use these as the parent for the menu group containing your command.

For example:


VSDebug Message

Menu data:

Guid = {**FFE1131C-8EA1-4D05-9728-34AD4611BDA9**}
GuidID = 962
CmdID = ***4113***
Type = 0x00000400
Flags = 0x04000000

NameLoc = (null)

OK

Where FFE1131C-8EA1-4D05-9728-34AD4611BDA9 is the context menu guid, and 4113 is the menu id.

Note, if you hold the CTRL+SHIFT while selecting an actual command, the same dialog will appear, but the guid and cmdid, will identify the specific command(menu item) selected.

Sincerely,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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