I already have a package that I created, and I'd like to add a menu to the Code Window
context menu.
After a little search I found several articles explaining how to do it. The problem is, I can't get it work....
Here are my declarations in the vsct
file:
<Button guid="guidDALGeneratorPkgCmdSet" id="cmdidDataFlow" priority="0x0100" type="Button">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/>
<CommandFlag>DynamicVisibility</CommandFlag>
<Strings>
<CommandName>cmdidDataFlow</CommandName>
<ButtonText>Show data flow</ButtonText>
</Strings>
</Button>
and the symbols:
<GuidSymbol name="guidDALGeneratorPkgCmdSet" value="{d3269a87-a721-49a5-800b-0464fbdfd313}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="cmdidDALGenerator" value="0x0101" />
<IDSymbol name="cmdidDataFlow" value="0x0102" />
</GuidSymbol>
and here is how I add my menu in my Package
class:
CommandID dataFlowCID = new CommandID(GuidList.guidDALGeneratorPkgCmdSet, (int)PkgCmdIDList.cmdidDataFlow);
OleMenuCommand dataFlowMenu = new OleMenuCommand(showDataFlow, dataFlowCID);
dataFlowMenu.BeforeQueryStatus += new EventHandler(dataFlowMenu_BeforeQueryStatus);
mcs.AddCommand(dataFlowMenu);
What am I doing wrong here? I must miss something because nearly every sample (and SO answer on the subject) suggests to add a menu that way in a package.....
What I have tried:
- make a group first then add my menu in that group: didn't work
- check if I use the right GUID (with this trick)
- use
IDG_VS_MENU_CONTEXTMENUS
instead ofIDM_VS_CTXT_CODEWIN
(after a look at this post: Using vsx how do you create a sub menu with commands?) - give the same parent as the menu that actually works to the second menu, still not showing....
- a lot of unsuccessful googling about my problem...
Also as you can see I use the BeforeQueryStatus
event, but it never gets fired...