user3026333
user3026333

Reputation: 43

Visual Studio 2022 Extension Context Menu GUID

I have written a vsix extension for VS 2022. I want my command to be available in the context menus for the code editor and on the .xaml editor. I have gotten the menu appearing for code window by using this guid:

Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"

I have not managed to find the correct guid to replace "IDM_VS_CTXT_CODEWIN" for the .xaml editor. This link:

https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.vsmenus.idm_vs_ctxt_codewin?redirectedfrom=MSDN&view=visualstudiosdk-2022

lists Guid for context menus but I can't see one for the design editor. Currently I am getting around this by adding it to the tool menu and checking if the document extension is .xaml and posting an error message if the file extension is incorrect. It would be nicer if the command was only available on the designer context menu.

Does anyone know if there is a context menu guid for the .xaml editor?

Upvotes: 4

Views: 1116

Answers (1)

Yevhen Cherkes
Yevhen Cherkes

Reputation: 861

You can find it in the article Walkthrough: Create a view adornment, commands, and settings...

...
<Parent guid="guidXamlUiCmds" id="IDM_XAML_EDITOR" />
...
<Symbols>
  ...
  <GuidSymbol name="guidXamlUiCmds" value="{4c87b692-1202-46aa-b64c-ef01faec53da}">
      <IDSymbol name="IDM_XAML_EDITOR" value="0x103" />
  </GuidSymbol>
  ...
</Symbols>

Upvotes: 2

Related Questions