Visual Studio 2010的插件 - 添加上下文菜单解决方案资源管理 [英] Visual Studio 2010 Plug-in - Adding a context-menu to the Solution Explorer

查看:425
本文介绍了Visual Studio 2010的插件 - 添加上下文菜单解决方案资源管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要添加在Visual Studio 2010中的解决方案资源管理器的右键菜单中的新选项为特定文件类型。因此,例如,右键单击一个* cs文件将显示现有的上下文菜单中加上我的新选择。

I want to add a new option in Visual Studio 2010's solution explorer's context menu for a specific file type. So for example, right clicking on a *.cs file will show the existing context menu plus "my new option".

我不知道什么code会是什么样子;并会喜欢一个指针开发的Visual Studio插件的一个很好的参考。教程/引用我看到有明显可怕。

I'm wondering what the code would look like; and would love a pointer to a good reference for developing visual studio plug-ins. The tutorials/references I'm seeing are conspicuously horrid.

谢谢!

推荐答案

我发现,最好的方式是让一个Visual Studio包而不是一个Visual Studio的插件中。该VSIX部署经验是如此光滑 - 整个事情是一个非常简单的经验。它仅支持Visual Studio 2010中,但这是不够好,在我的情况。

I found that the best way to go was to make a Visual Studio Package instead of an Visual Studio Add-in. The vsix deployment experience is so slick - the whole thing was a really easy experience. It only supports Visual Studio 2010, but that was good enough in my case.

下面是所得vsct:

<Commands package="guidBingfooPluginPkg">
    <Groups>
      <Group guid="guidBingfooPluginCmdSet" id="MyMenuGroup" priority="0x0600">
        <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>
      </Group>
    </Groups>

    <Buttons>
      <Button guid="guidBingfooPluginCmdSet" id="cmdidfooLocalBox" priority="0x0100" type="Button">
        <Parent guid="guidBingfooPluginCmdSet" id="MyMenuGroup" />
        <!-- <Icon guid="guidImages" id="bmpPic1" /> -->
        <CommandFlag>DynamicVisibility</CommandFlag>
        <Strings>
          <CommandName>cmdidfooLocalBox</CommandName>
          <ButtonText>View in foo</ButtonText>
        </Strings>
      </Button>

      <Button guid="guidBingfooPluginCmdSet" id="cmdidfooTestBed" priority="0x0100" type="Button">
        <Parent guid="guidBingfooPluginCmdSet" id="MyMenuGroup" />
        <CommandFlag>DynamicVisibility</CommandFlag>
        <Strings>
          <CommandName>cmdidfooTestBed</CommandName>
          <ButtonText>View in foo on Test Beds</ButtonText>
        </Strings>
      </Button>

    </Buttons>

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

  <Symbols>
    <GuidSymbol name="guidBingfooPluginPkg" value="{62c4a13c-cc61-44a0-9e47-33111bd323ce}" />

    <GuidSymbol name="guidBingfooPluginCmdSet" value="{59166210-d88c-4259-9809-418bc332b0ab}">
      <IDSymbol name="MyMenuGroup" value="0x1020" />
      <IDSymbol name="cmdidfooLocalBox" value="0x0100" />
      <IDSymbol name="cmdidfooTestBed" value="0x0101" />
    </GuidSymbol>

    <GuidSymbol name="guidImages" value="{2dff8307-a49a-4951-a236-82e047385960}" >
      <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" />
    </GuidSymbol>
  </Symbols>
</CommandTable>

这篇关于Visual Studio 2010的插件 - 添加上下文菜单解决方案资源管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆