获取 DTE.ExecuteCommand 可用命令的完整列表 [英] Get full list of available commands for DTE.ExecuteCommand

查看:21
本文介绍了获取 DTE.ExecuteCommand 可用命令的完整列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 VS2010 和 Addin,使用 DTE.ExecuteCommand 和 Build、Build.Cancel、Build.RebuildSolution 等命令.

您可以使用 DTE.Commands.Item("xxx") 获取命令并猜测是否可以使用 Command.IsAvailable.命令列表位于工具、选项窗口、环境、键盘部分.

同样,如您所知,DTE.ExecuteCommand 将两个字符串作为参数.

第一个是命令的名称(例如,Action.CreateNewShortcut),第二个是命令采用的参数.

问题是某些命令需要可变数量的参数,我不知道顺序等.

例如,我猜 Action.CreateNewShortcut 至少需要两个参数:执行快捷方式时要运行的操作 (Build.RebuildSolution) 和快捷方式本身 (Alt+O).

VS 中有超过 4k 条命令.但我认为微软还没有关于它的官方文档.

任何带有 DTE.ExecuteCommand 可用命令的完整列表的官方文档都会非常有用

有什么建议吗?

解决方案

可以按照以下过程检查命令列表:

  • 打开 Visual Studio 的

    I use VS2010 and Addin, using DTE.ExecuteCommand and commands like Build, Build.Cancel, Build.RebuildSolution, etc.

    You can get a command with DTE.Commands.Item("xxx") and guess if it is available with Command.IsAvailable. The list of commands is in the Tools, Options window, Environment, Keyboard section.

    Too, as you know DTE.ExecuteCommand takes two strings as parameters.

    The first one is the name of the command (for example, Action.CreateNewShortcut) and the second one is the arguments that the command takes.

    The problem is that some commands require a variable number of arguments and I don't know the order, etc.

    For example I guess Action.CreateNewShortcut needs at least two arguments: the action to be run when the shortcut is executed (Build.RebuildSolution) and the shortcut itself ( Alt+O).

    There are over 4k commands in VS. but Microsoft hasn't official documentation about it, I think.

    It would be very useful any official documentation with FULL list of available commands for DTE.ExecuteCommand

    Any suggestions?

    解决方案

    A list of commands can be examined by following this procedure:

    • Open Visual Studio's Options Dialog Box
    • Select the Environment/Keyboard page
    • You can search for a specific command in the "Show commands containing:" box, or just scroll the list behind it.

    这篇关于获取 DTE.ExecuteCommand 可用命令的完整列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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