If that´s your case, it is sometimes a pain in the ass work with the solution explorer. In addition to that, Visual Studio sometimes expands the full solution when opens it. How much time have you wasted clicking project by project just to get a tiny, collapsed solution?
No more!
Thanks to Edwin Evans we have a simple VB Macro that collapses the entire solution. You can find the article here.
I´ve tried it and It works, at least in Visual Studio 2008. I´ll post another article today on how to customize your toolbar… keep reading!
PS: To your comfort, I paste here Edwin Evans code:
Sub CollapseAll()
' Get the the Solution Explorer tree
Dim UIHSolutionExplorer As UIHierarchy
UIHSolutionExplorer = DTE.Windows.Item( _
Constants.vsext_wk_SProjectWindow).Object()
' Check if there is any open solution
If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
' MsgBox("Nothing to collapse. You must have an open solution.")
Return
End If
' Get the top node (the name of the solution)
Dim UIHSolutionRootNode As UIHierarchyItem
UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
' Collapse each project node
Dim UIHItem As UIHierarchyItem
For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
UIHItem.UIHierarchyItems.Expanded = False
Next
' Select the solution node, or else when you click
' on the solution window
' scrollbar, it will synchronize the open document
' with the tree and pop
' out the corresponding node which is probably not what you want.
UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
End Sub