如何在网站项目中添加上下文菜单条目? [英] How to add context menu entries in website projects?
问题描述
我无法为网站项目项添加上下文菜单条目.
I'm not able to add context menu entries for website project items.
如何重现问题:
- 创建一个 VS 包项目
转到 vsct 文件并将
groups
部分替换为:
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ITEMNODE"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_FOLDERNODE"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_SOLNNODE"/>
</Group>
我确信这一定是可能的,因为 NuGet 有一个网站项目条目.不幸的是,我无法从 NuGet 源代码中提取那段代码.
I'm sure this must be possible due to the fact, that NuGet has an entry for the website project item. unfortunately, I was not able to extract that piece of code from the NuGet source code.
推荐答案
过了一会儿我找到了一个解决方案:(无意中查看了 StyleCop 源代码 :P)
After a while I found a solution: (I accidentally looked into the StyleCop source code :P)
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0050">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_WEBFOLDER"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0050">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_WEBITEMNODE"/>
</Group>
<Group guid="guidVSPackage1CmdSet" id="MyMenuGroup" priority="0x0050">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_WEBPROJECT"/>
</Group>
MSDN 上没有记录这些内容.
These are not documented on MSDN.
无论如何,我很好奇 NuGet 是如何做到的,因为它们在 vsct
文件中没有任何内容,只有上下文菜单中的一个条目.
Anyway, I'm curious how NuGet does it, because they have nothing in the vsct
file, but an entry in the context menu.
这篇关于如何在网站项目中添加上下文菜单条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!