Calling VS2012 Solution Explorer Commands in Code

I am trying to make an extension, and I need to call two commands from the code ...

  • SolutionExplorer.SyncWithActiveDocument
  • Collapse All command in Solution Explorer.

I still can't find these features.

Does anyone know how to do this?

+4
source share
1 answer

Have you tried to execute commands through DTE?

dte.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate(); // Sync with Active Document dte.ExecuteCommand("SolutionExplorer.SyncWithActiveDocument"); // Collapse All int cmdidSolutionExplorerCollapseAll = 29; Guid guidCMDSETID_StandardCommandSet11 = new Guid("D63DB1F0-404E-4B21-9648-CA8D99245EC3"); dte.Commands.Raise(guidCMDSETID_StandardCommandSet11.ToString("B"), cmdidSolutionExplorerCollapseAll, null, null); 

If you need to identify the identifier for any other commands, you can enable VSIP logging: http://blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus -and-commands-with-vs-2005-sp1.aspx

+4
source

Source: https://habr.com/ru/post/1437306/


All Articles