Create context sub menu in visual studio 2015

淺唱寂寞╮ 提交于 2019-12-12 04:29:44

问题


This is the VSCT file I have created. I would want to make it so that the menu item appears in the context sub menu in visual studio whereby a right click will activate the command.

I have used the code from here however after configuring the VSCT file, it launches and experimental instance of VS2015 and nothing is shown in the solutions explorer tab after opening a project.

<Groups>
  <Group guid="guidTestStatusBarCommandPackageCmdSet" id="MyMenuGroup" priority="0x0600">
    <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
  </Group>
</Groups>

<!--Buttons section. -->
<!--This section defines the elements the user can interact with, like a menu command or a button
    or combo box in a toolbar. -->
<Buttons>

  <Button guid="guidTestStatusBarCommandPackageCmdSet" id="TestStatusBarCommandId" priority="0x0100" type="Button">
    <Parent guid="guidTestStatusBarCommandPackageCmdSet" id="MyMenuGroup" />
    <Icon guid="guidImages" id="bmpPic1" />
    <Strings>
      <ButtonText>Invoke TestStatusBarCommand</ButtonText>
    </Strings>
  </Button>
</Buttons>

<Bitmaps>

  <Bitmap guid="guidImages" href="Resources\TestStatusBarCommand.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>
</Bitmaps>
</Commands>

<Symbols>

<GuidSymbol name="guidTestStatusBarCommandPackage" value="{3e986576-99a2-451f-b96f-db7a23a0a2d3}" />

<!-- This is the guid used to group the menu commands together -->
<GuidSymbol name="guidTestStatusBarCommandPackageCmdSet" value="{f65185c1-2d22-4541-b844-ebb6193c3223}">
  <IDSymbol name="MyMenuGroup" value="0x1020" />
  <IDSymbol name="TestStatusBarCommandId" value="0x0100" />
</GuidSymbol>

<GuidSymbol name="guidImages" value="{4cf0f225-63ff-4812-907d-a763c7eb7c23}" >
  <IDSymbol name="bmpPic1" value="1" />
  <IDSymbol name="bmpPic2" value="2" />
  <IDSymbol name="bmpPicSearch" value="3" />
  <IDSymbol name="bmpPicX" value="4" />
  <IDSymbol name="bmpPicArrows" value="5" />
  <IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>

What am I doing wrong here?


回答1:


I create a demo and reproduce your issue on our side, please modify the follow code

    <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>

to:

          <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>



来源:https://stackoverflow.com/questions/40339674/create-context-sub-menu-in-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!