Get full list of available commands for DTE.ExecuteCommand
Asked Answered
F

4

11

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?

Ferric answered 13/12, 2012 at 7:58 Comment(0)
D
14

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.

enter image description here

Dielle answered 22/10, 2013 at 7:18 Comment(0)
G
7

You can use immediate window to do it. Simply type '>' and start typing command.

Gloat answered 1/7, 2013 at 8:23 Comment(0)
G
6

Question is a bit old, but I ran into the same recently. I used the Commands collection from EnvDTE.DTE (here), that can be retrieved in a few lines of power shell. As you mentionned, the list is very long, and you may want to filter the output.

# 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()
Glazunov answered 21/12, 2016 at 15:13 Comment(1)
This can be done right through the package manager console in VS, as it provides a $dte instance without having to cull the registry for the right type. Works in 2015 and 2017.Synovitis
D
4

Here is the list that Mads Kristensen uses for his VoiceExtension add-in:

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

Dielle answered 22/10, 2013 at 7:6 Comment(1)
Link broken. Try github.com/ligershark/VoiceExtension/blob/master/src/Resources/…Patriarchy

© 2022 - 2024 — McMap. All rights reserved.