Visual Studio加载项-将上下文菜单项添加到solution-explorer [英] Visual Studio Add-In - adding a context menu item to solution-explorer

查看:213
本文介绍了Visual Studio加载项-将上下文菜单项添加到solution-explorer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Visual Studio开发我的第一个外接程序,我们需要向解决方案资源管理器中添加一个上下文菜单项,该菜单项仅针对特定文件类型显示(在我们的示例中为".resx")

I'm developing my first add-in for Visual studio and we need to add a context menu item to the solution explorer, that shows up for particular file types only (in our case - ".resx").

我已经搜索了2天,无法找到任何教程或代码示例……只有非常基本的内容,例如在VS工具"菜单中添加菜单项等.

I've been googling for 2 days now, unable to find any tutorials or code-samples... Only very basic things like adding a menu-item to the VS "tools" menu etc.

推荐答案

好,您需要创建一个动态可见的命令,仅当解决方案资源管理器中的选定节点是.resx文件时,该命令才可见作为Solution Explorer上下文菜单的子级(您需要GUID:ID对).

Well, you need to create a dynamically visible command that you will make visible only when the selected node in the Solution Explorer is .resx file and then add the command as a child of the Solution Explorer context menu (you would need GUID:ID pair of the latter).

这是一篇很好的文章,展示了如何执行此操作:

Here is a good article showing how to do that: http://blogs.rev-net.com/ddewinter/2008/03/22/dynamic-menu-commands-in-visual-studio-packages-part-2/

这篇关于Visual Studio加载项-将上下文菜单项添加到solution-explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆