c# - 创建 Visual Studio 扩展添加菜单和表单
问题描述
我正在尝试将一个菜单项添加到我的 Visual Studio 自定义扩展中,但是当我尝试编译它时说 guidTopLevelMenuPackageCmdSet 不存在,即使我已经创建了一个命令对象。
<Menus>
<Menu guid="CommandSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu"
id="IDG_VS_MM_TOOLSADDINS" />
<Strings>
<ButtonText>TestMenu</ButtonText>
<CommandName>TestMenu</CommandName>
</Strings>
</Menu>
</Menus>
<!-- In this section you can define new menu groups. A menu group is a container for
other menus or buttons (commands); from a visual point of view you can see the
group as the part of a menu contained between two lines. The parent of a group
must be a menu. -->
<Groups>
<Group guid="CommandSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="CommandSet" id="TopLevelMenu"/>
</Group>
</Groups>
现在我希望我的扩展程序能够启动一个表单我如何正确地实现这一点我在这里尝试了教程,但不清楚你从哪里获得指南。https://www.c-sharpcorner.com/article/creating-visual-studio-2019-extension/
我从基本模板开始,但是当我调试时它没有正确添加菜单是他们缺少的东西。
<!-- In this section you can define new menu groups. A menu group is a container for
other menus or buttons (commands); from a visual point of view you can see the
group as the part of a menu contained between two lines. The parent of a group
must be a menu. -->
<Menus>
<Menu guid="CommandSet" id="TopLevelMenu" priority="0x700" type="Menu">
<Parent guid="guidSHLMainMenu"
id="IDG_VS_MM_TOOLSADDINS" />
<Strings>
<ButtonText>TestMenu</ButtonText>
<CommandName>TestMenu</CommandName>
</Strings>
</Menu>
</Menus>
<!-- In this section you can define new menu groups. A menu group is a container for
other menus or buttons (commands); from a visual point of view you can see the
group as the part of a menu contained between two lines. The parent of a group
must be a menu. -->
<Groups>
<Group guid="CommandSet" id="MyMenuGroup" priority="0x0600">
<Parent guid="CommandSet" id="TopLevelMenu"/>
</Group>
</Groups>
解决方案
对于其他任何人,如果您查看 vscx 文件,您将在底部看到以下内容。在这里,您将看到 guidEfCoreCrudBootStrapPackageCmdSet 与您在教程中创建的 ICommand 界面中的 guid 命令集值匹配。
<GuidSymbol name="guidEfCoreCrudBootStrapPackageCmdSet" value="{5017a255-b672-4113-b19a-422a35b0af64}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="EfCoreCrudBootStrapCommandId" value="0x0100" />
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="SampleCommandId" value="0x0100" />
<IDSymbol name="SampleMenu" value="0x1021"/>
</GuidSymbol>
<GuidSymbol name="guidImages" value="{14c1b0d2-fd1c-41b4-88f0-9545d5ecdf31}" >
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>
推荐阅读
- material-ui - 任何类似于 bootswatch 的 material-ui 简单/基本主题集合?
- json - 访问嵌套元素
- google-bigquery - 为什么 biguery.tables.list 和 bigquery.tables.get 权限不属于“所有者”角色?
- r - For循环在多个目录中进行图像采样
- python - 给定一个数字 N,交换其中的两个半字节并找到结果数字
- python - 如何使用精灵组和杀死精灵组
- google-cloud-platform - 服务帐户无法将项目附加到共享 VPC
- r - 重塑表格:通过每年重复多个列来扩大表格
- java - 在一行上打印多行 int 值作为分隔字符串
- arrays - 用于 jQuery 数据表的 PowerShell DB2 数据表行到 JSON 文件