I created a Visual Studio menu extension that I deploy via a VSIX package; now I need to create a new VSIX package to add submenus to the previous one.
I have created a Visual Studio extension menu (A) via a VSIX project, that contains a button.
First extension result:
Now I'm trying to create a second VSIX project, and my goal is to create a submenu (B) that is child of (A), by preserving all the pre-existing buttons; I need to create a sort of modular behavior, so I cannot create just a single VSIX project.
However, when I try and install the second VSIX package, it seems that it overwrites the first extension, and I see only the second.
Second extension result:
My wanted goal is as shown in the following picture:
I already found this other question and I tried what it suggested, but with no luck.
The file *.vsct
of the first project is
<?xml version="1.0" encoding="utf-8"?>
<CommandTable ...>
<Extern href="stdidcmd.h" />
<Extern href="vsshlids.h" />
<Commands package="guidMyTestVSPackage">
<Menus>
<Menu guid="guidMyTestPackageCmdSet" id="TopMenu" priority="0x100" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_MM_TOOLSADDINS" />
<Strings>
<ButtonText>MyApp</ButtonText>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidAboutPackageCmdSet" id="MyTestAboutMenuGroup" priority="0x0E00">
<Parent guid="guidMyTestPackageCmdSet" id="TopMenu" />
</Group>
</Groups>
<Buttons>
<Button guid="guidAboutPackageCmdSet" id="cmdidAboutCommand" priority="0x0100" type="Button">
<Parent guid="guidAboutPackageCmdSet" id="MyTestAboutMenuGroup" />
<Strings>
<ButtonText>About</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidMyTestVSPackage" value="{212cdc15-f054-46cf-8db5-a4e2a75c0d1e}" />
<GuidSymbol name="guidMyTestPackageCmdSet" value="{2ca5942d-9e0f-48cb-9eb8-a979358ff308}">
<IDSymbol name="TopMenu" value="0x1022" />
</GuidSymbol>
<GuidSymbol name="guidAboutPackageCmdSet" value="{4b9c6cc9-e54e-4ded-84ff-161c3bde5ad7}">
<IDSymbol value="4128" name="MyTestAboutMenuGroup" />
<IDSymbol value="256" name="cmdidAboutCommand" />
</GuidSymbol>
</Symbols>
</CommandTable>
The file *.vsct
of the second project is
<?xml version="1.0" encoding="utf-8"?>
<CommandTable ...>
<Extern href="stdidcmd.h" />
<Extern href="vsshlids.h" />
<Commands package="guidMyTestVSPackage">
<Menus>
<Menu guid="guidMyTestPackageCmdSet" id="TopMenu" priority="0x100" type="Menu">
<Parent guid="guidSHLMainMenu" id="IDG_VS_MM_TOOLSADDINS" />
<Strings>
<ButtonText>MyApp</ButtonText>
</Strings>
</Menu>
<Menu guid="guidMyTestPackageCmdSet2" id="testMenu" priority="0x100" type="Menu">
<Parent guid="guidMyTestPackageCmdSet2" id="MyAppMenuGroup" />
<Strings>
<ButtonText>MyTest 2023</ButtonText>
</Strings>
</Menu>
</Menus>
<Groups>
<Group guid="guidMyTestPackageCmdSet2" id="MyAppMenuGroup" priority="0x0000">
<Parent guid="guidMyTestPackageCmdSet" id="TopMenu"/>
</Group>
<Group guid="guidMyTestPackageCmdSet2" id="testMenuGroup" priority="0x0000">
<Parent guid="guidMyTestPackageCmdSet2" id="testMenu"/>
</Group>
<Group guid="guidMyTestPackageCmdSet2" id="MyTestMenuGroup" priority="0x0600">
<Parent guid="guidMyTestPackageCmdSet2" id="testMenu" />
</Group>
</Groups>
<Buttons>
<Button guid="guidMyTestPackageCmdSet2" id="MyTestCommandId" priority="0x0100" type="Button">
<Parent guid="guidMyTestPackageCmdSet2" id="MyTestMenuGroup" />
<Strings>
<ButtonText>Add MyTest NuGet Package</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidMyTestVSPackage" value="{212cdc15-f054-46cf-8db5-a4e2a75c0d1f}" />
<GuidSymbol name="guidMyTestPackageCmdSet" value="{2ca5942d-9e0f-48cb-9eb8-a979358ff308}">
<IDSymbol name="TopMenu" value="0x1022" />
</GuidSymbol>
<GuidSymbol name="guidMyTestPackageCmdSet2" value="{2ca5942d-9e0f-48cb-9eb8-a979358ff309}">
<IDSymbol name="testMenu" value="0x1021" />
<IDSymbol name="testMenuGroup" value="0x1026" />
<IDSymbol name="MyAppMenuGroup" value="0x1023" />
<IDSymbol name="MyTestMenuGroup" value="0x1020" />
<IDSymbol name="MyTestCommandId" value="0x0100" />
</GuidSymbol>
</Symbols>
</CommandTable>