10

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?

4

4 回答 4

12

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

  • 打开 Visual Studio 的选项对话框
  • 选择环境/键盘页面
  • 您可以在“显示包含:的命令”框中搜索特定命令,或者只是滚动它后面的列表。

在此处输入图像描述

于 2013-10-22T07:18:33.817 回答
7

您可以使用即时窗口来执行此操作。只需输入“>”并开始输入命令。

于 2013-07-01T08:23:54.407 回答
6

问题有点老了,但我最近遇到了同样的问题。我使用了来自 EnvDTE.DTE(此处)的 Commands 集合,它可以在几行 power shell 中检索到。正如您所提到的,列表很长,您可能想要过滤输出。

# Get Visual Studio 2015 type
# -- find other version in registry HKEY_CLASSES_ROOT\VisualStudio.DTE.x.x
$type = [System.Type]::GetTypeFromProgID("VisualStudio.DTE.14.0")
# Create an instance of EnvDTE.DTE - actually launches a devenv.exe process
$dte = [System.Activator]::CreateInstance($type,$true)
# list of Commands is output simply when typing : Can be very long
$dte.Commands
# Will output the name of the command, its GUID and other attributes
# Close process when done
$dte.Quit()
于 2016-12-21T15:13:56.843 回答
4

这是Mads Kristensen用于他的VoiceExtension插件的列表:

https://github.com/ligershark/VoiceExtension/blob/master/src/Resources/commands.txt

于 2013-10-22T07:06:33.927 回答