locked
VSX Context Menu RRS feed

  • Question

  • How to add new button to context menu of solution explorer through VS Package?
    Tuesday, April 15, 2014 11:42 AM

All replies

  • Hi,

    Please refer to the similar thread.

    Visual Studio 2010 Plug-in - Adding a context-menu to the Solution Explorer

    The vsix deployment experience is so slick - the whole thing was a really easy experience. It only supports Visual Studio 2010.

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

    Best regards,

    Sunny

    Wednesday, April 16, 2014 11:28 AM
  • You need to set your command group parent to an IDM_VS_CTXT_ enumeration value. Like this:

    <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE" />
    See also http://stackoverflow.com/questions/9531387/vs2010-vspackage-adding-command-for-certain-filetypes-in-the-context-menu

    Sergey Vlasov | Vlasov Studio | Visual Studio add-ins, extensions and tools

    Wednesday, April 16, 2014 11:34 AM