解决方案树项目命令 [英] Solution tree item commands

查看:69
本文介绍了解决方案树项目命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自澳大利亚的你好。我是第一次研究VS可扩展性,试图将自定义命令添加到对特定项目/文件类型可见的解决方案树项目中。例如,右键单击.bat文件将提供Run命令,.nuspec
文件将提供Pack命令,依此类推。针对不同项目类型的命令将大大提高生产力。

Hello from Australia. I'm researching VS extensibility for the first time in an attempt to add custom commands to solution tree items that are visible for specific item/file types. For example, right-click a .bat file would provide a Run command, a .nuspec file would provide a Pack command, and so on. Commands for different item types would be a great productivity boost.

我的测试扩展基于搜索中找到的各种样本。我对测试命令的结果感到困惑。默认情况下将 命令设置为不可见意味着它永远不会被构造。  BeforeQueryStatus事件仅在第一次调用
之后引发,因此我无法检查该项目以查看该命令是否应该可见。然后我完全不知道如何找到被选中的项目。

My test extension is based on various samples found in searches. I'm confused by the results of testing the command. Setting the command invisible by default means it will never be constructed. The BeforeQueryStatus event is only raised after the first invoke, so I can't inspect the item to see if the command should be visible or not. Then I am utterly stumped about how to find which item(s) are selected.

我基本上已经迷失并且困惑不已。命令事件序列毫无意义,我无法浏览令人眼花缭乱的对象模型,类,枚举和服务。所以我想知道这个论坛中的任何人是否有一些样本甚至模糊地类似于我正在尝试的
。如果我能弄清楚如何使命令仅对某些解决方案树项类型可见,那么我将关闭并运行。任何人都可以帮忙吗?

I am basically lost and confused beyond hope. The command event sequence makes no sense and I can't navigate the bewildering object model, classes, enums and services. So I'm wondering if anyone in this forum has some samples that are even vaguely similar to what I'm attempting. If I can just figure out how make a command visible only for certain solution tree item types then I will be off and running. Can anyone help?

谢谢,Greg

推荐答案

我已经完成了你的尝试和经历过类似的痛苦。但是当你做对了,它是可行的并且运作良好。我最终管理了它。您使用哪个版本的visual studio作为2017年扩展程序有点不同。我还没有在2017年写过任何扩展名
但是可以帮助使用早期版本。

Hi, I've done what your trying and experienced similar pain. But it is doable and works well when you get it right. I managed it in the end. Which version of visual studio are you using as 2017 extensions are a little different. I haven't written any extensions in 2017 yet but can help with earlier versions.

我将不得不挖出代码并刷新内存,所以让我吧知道这是否有帮助。即使你使用的是2017年我想(我现在读了一段时间)这些变化主要是结构/包装。我可能错了。

I'll have to dig out the code and refresh my memory a bit so let me know if that'll help. Even if you are using 2017 I think (I read about it a while back now) the changes are structural/packaging mainly. I could be wrong though.


这篇关于解决方案树项目命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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