Search code examples
c#asp.net-mvcvisual-studio-2013visual-studio-package

My context menu item made by menu command in Visual Studio Package is not shown in cshtml files


I made a menu command and it works fine in .cs files as you can see below.

enter image description here

The penultimate item "Build this project" is the created item.

But when I try it in cshtml files, this item is not shown.

I'm suspecting that the problem is in the Groups section of my vsct file.

enter image description here

I'm setting the menu item as a child of IDM_VS_CTXT_CODEWIN

Looking for a similar issue, I found the Microsoft VsMenus page: https://msdn.microsoft.com/en-us/library/bb163231(v=vs.100)

In this page I didn't find another parent to my menu item.

My goal is to build the active document's project directly from this menu item in context menu of VS's editor.

Can someone help me?

Thanks


Solution

  • I had the same problem and I found that the following GuidSymbol has to be defined:

    <GuidSymbol name="HtmlEditorWindowLibra" value="{78F03954-2FB8-4087-8CE7-59D71710B3BB}">
        <IDSymbol name="IDMX_HTML_SOURCE" value="1"/>
    </GuidSymbol>
    

    Then, you can use it as follows:

    <Group guid="guidBuildThisProjectCmdSet" id="grpIdMenuHtmlSource" priority="0x0600">
        <Parent guid="HtmlEditorWindowLibra" id="IDMX_HTML_SOURCE"/>
    </Group>
    

    More useful GuidSymbos can be found in the file ClipboardDiff.vsct which is a part of Github ClipboardDiff project.