locked
SDK Package: Trying to get correct id for XAML editor context menu RRS feed

  • Question

  • I am writing a VS 2012 package and I want to add a new option to the XAML code editor window.  I am using EnableVSIPLogging to find the ids for the menus.

    I have done the same with the code editor context menu and it works, my new option appears ok on the menu:
    The logging info shows the CmdID = 1037 which in hex is 40D and looking in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VSSDK\VisualStudioIntegration\Common\Inc\vsshlids.h this is IDM_VS_CTXT_CODEWIN

          <Group guid="guidAJCVSWPFCodeCmdSet" id="MyCodeGroup" priority="0x0600">
            <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/>
          </Group>

    Now I try and do the same with the XAML code editor context menu:
    The logging info shows the CmdID = 259 which in hex is 103 and looking in vsshlids.h this is IDG_VS_MM_BUILDDEBUGRUN which does not sound correct to me.  I try it and it does not work, my new option does not appear on the XAML code editor context menu.

    Why does this logging info not work for the XAML editor context menu?

    How can I find the correct ID to use for the XAML editor menu?

    Thanks

    Monday, December 2, 2013 10:33 AM

Answers

  • >The logging info shows the CmdID = 259 which in hex is 103 and looking in vsshlids.h this is IDG_VS_MM_BUILDDEBUGRUN which does not sound correct to me.  

    Groups (and any other command ID) have two components, the GUID and the DWORD, DWORDS are only unique within the 'namespace' of their associated GUID, so saying '259' is X only makes sense in a specific GUID namespace, and the XAML editor menu is not in guidSHLMainMenu, it is in XamlUiCmdsGuid (at least that is what it is called internally) and its value is {4c87b692-1202-46aa-b64c-ef01faec53da}, as shown in the EnableVSIPLogging dialog. You can define it locally in your VSCT just like you define your own symbolic entities (like guidAJCVSWPFCodeCmdSet for instance).

    • Marked as answer by Anna Cc Wednesday, December 4, 2013 12:18 PM
    Monday, December 2, 2013 6:00 PM

All replies

  • >The logging info shows the CmdID = 259 which in hex is 103 and looking in vsshlids.h this is IDG_VS_MM_BUILDDEBUGRUN which does not sound correct to me.  

    Groups (and any other command ID) have two components, the GUID and the DWORD, DWORDS are only unique within the 'namespace' of their associated GUID, so saying '259' is X only makes sense in a specific GUID namespace, and the XAML editor menu is not in guidSHLMainMenu, it is in XamlUiCmdsGuid (at least that is what it is called internally) and its value is {4c87b692-1202-46aa-b64c-ef01faec53da}, as shown in the EnableVSIPLogging dialog. You can define it locally in your VSCT just like you define your own symbolic entities (like guidAJCVSWPFCodeCmdSet for instance).

    • Marked as answer by Anna Cc Wednesday, December 4, 2013 12:18 PM
    Monday, December 2, 2013 6:00 PM
  • Thank you very much Ryan.  I understand it now, all the other menu items I was doing were under guidSHLMainMenu.  Its now working.

    This has dug me out of a hole.  If you drop me an email you can have a free license for AJC Active Backup v2 which is a very useful tool for all developers.  Follow the link below:

    http://www.ajcsoft.com/active-backup-2.htm

    Tuesday, December 3, 2013 10:36 AM
  • Hello I am using this to bring a new option in xaml code editor context menu through vsix please guide me where I am going wrong.Any help will be beneficial for me.

     <GuidSymbol name="XamlUiCmdsGuid" value="{4c87b692-1202-46aa-b64c-ef01faec53da}" />

      <Button guid="guidMenuAndCommandsCmdSet" id="GotoViewModelEditorWindowXaml" priority="0x200" type="Button">
              <Parent guid="guidMenuAndCommandsCmdSet" id="MyEditorCtxGroupXaml"/>
              <Icon guid="ImageCatalogGuid" id="GoToNext"/>
              <Strings>
                <ButtonText>Go to ViewmodelXaml</ButtonText>
              </Strings>
            </Button>

    <Group guid="guidMenuAndCommandsCmdSet" id="MyEditorCtxGroupXaml" priority="0x700">
            <Parent guid="XamlUiCmdsGuid" id="IDM_VS_CTXT_CODEWIN"/>
          </Group>

    Friday, December 6, 2019 6:11 AM