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
source share