【问题标题】:Create context sub menu in visual studio 2015在 Visual Studio 2015 中创建上下文子菜单
【发布时间】:2016-11-01 19:30:01
【问题描述】:

这是我创建的 VSCT 文件。我想让菜单项出现在 Visual Studio 的上下文子菜单中,从而右键单击将激活命令。

我使用了here 中的代码,但是在配置 VSCT 文件后,它会启动 VS2015 的实验实例,并且在打开项目后,解决方案资源管理器选项卡中没有显示任何内容。

<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>

我在这里做错了什么?

【问题讨论】:

  • 这可能会有所帮助:stackoverflow.com/questions/19741658/…
  • @Matze 嗨!尝试该方法后,在 VS2015 的实验实例中启动时,我打开了一个以前的项目,但在解决方案资源管理器选项卡上没有显示任何内容。帮忙?

标签: c# visual-studio visual-studio-2015 visual-studio-extensions


【解决方案1】:

我创建了一个演示并在我们这边重现了您的问题,请修改以下代码

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

到:

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

【讨论】:

  • @ChrisB 。谢谢你的形象和指导,我只是搞砸了,粗心!干杯! :)
猜你喜欢
  • 1970-01-01
  • 2016-08-19
  • 2014-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-16
  • 2019-11-20
  • 1970-01-01
相关资源
最近更新 更多