Visual Studio 2019 16.5.0 preview 1.
I'm trying to get my menu items to show up either in a group or on a different menu.
Currently the menu items show up in the View/Other Windows menu on visual studio if I point them to IDG_VS_WNDO_OTRWNDWS1, but if I try to point them to MyMenuGroup, they just don't appear. The code will run but the menu items never show up on the menu. If I try to point the buttons to IDM_VS_MENU_EXTENSIONS, it won't even compile, giving the error below:
Undefined 'Parent/@id' attribute 'IDM_VS_MENU_EXTENSIONS' in a <Button> element
Below is my code:
<Groups>
<Group guid="MyGroupMenuSet" id="MyMenuGroup" priority="0x0100">
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1" />
</Group>
</Groups>
<Buttons>
<Button guid="My_ExtVS2019PackageCmdSet" id="cmdidMyWindowCommand" priority="0x0100" type="Button">
<!-- <Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1" /> -->
<Parent guid="MyGroupMenuSet" id="MyMenuGroup" />
<Strings>
<ButtonText>My Main Window</ButtonText>
</Strings>
</Button>
<Button guid="My_ExtVS2019PackageCmdSet" id="cmdidMyOtherControlCommand" priority="0x0100" type="Button">
<!--<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1" />-->
<Parent guid="MyGroupMenuSet" id="MyMenuGroup" />
<Strings>
<ButtonText>My Other Window</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="My_ExtVS2019Package" value="{a28e16ed-f550-4cac-b087-f3728834a026}" />
<GuidSymbol value="{3d62bd83-4a3e-4e04-8ea8-800ea9316e90}" name="My_ExtVS2019PackageCmdSet">
<IDSymbol value="256" name="cmdidMyWindowCommand" />
<IDSymbol value="257" name="cmdidMyOtherControlCommand" />
</GuidSymbol>
<GuidSymbol value="{dd7dd38d-bf53-408e-baa4-c5c7c7774f19}" name="MyGroupMenuSet">
<IDSymbol value="4128" name="MyMenuGroup" />
<IDSymbol value="256" name="cmdidCommand1" />
</GuidSymbol>
</Symbols>
Any clue what's wrong with my code?
Button's parent should be a
group
type. AndIDG_VS_WNDO_OTRWNDWS1
is one child group ofIDG_VS_VIEW_DEV_WINDOWS
, so it works as we expected.MyMenuGroup
andIDG_VS_WNDO_OTRWNDWS1
also representGroup
type. One group's parent should be one menu instead of a group, or it won't work. See my another issue here.So if you want to use your custom group, you should use this structure in
xx.vsct
:Button => MyMenuGroup(group) => one menu(menu) => IDG_VS_WNDO_OTRWNDWS1(group)
instead of:
Button => MyMenuGroup(group) => IDG_VS_WNDO_OTRWNDWS1(group)
Workaround:
Change this part:
To:
And don't forget to define the
MyMenu
inGuidSymbol
:Then now VS can work to display your two windows in this way(View=>Other windows):
In addition: As for the Undefined
IDM_VS_MENU_EXTENSIONS
, I've post the feedback here. In my opinion, this could be one issue about the document or the build tools package, anyone interested in it can track the issue and get the latest info there.Hope it helps:)