Get full list of available commands for DTE.ExecuteCommand

后端 未结 4 685
失恋的感觉
失恋的感觉 2021-02-02 02:14

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\")

4条回答
  •  [愿得一人]
    2021-02-02 02:57

    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()
    

提交回复
热议问题