Search code examples
visual-studio-2013visual-studio-extensionsvsixvsxvspackage

Choosing where my menu item appears for a VSPackage extension


I am trying to create a visual studio extension menu item and I am having a tough time finding out how to choose which context menu the extension shows up in. Example; I right click on a TFS ticket and I see my added menu item in the context menu and not in the Tools menu. What in a VSPackage project tells Visual Studio where to place my extension?


Solution

  • In your package vsct file the CommandPlacements node handles where to put command items. Generally you are looking at CommandPlacements->CommandPlacement->Parent->id=[Some visual studio constant guid for the menu you want.]

    Example, this places my command in the right click context menu of a code editor window, the guid is defined in the constant IDM_VS_CTXT_CODEWIN.

    <CommandPlacement guid="guidSquishEditorCmdSet" id="SquishEditorToolbarGroup" priority="0x600">
      <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN" />
    </CommandPlacement>