Visual Studio: Is there a way to collapse all items of Solution Explorer?
.NetVisual Studio-2008.Net Problem Overview
I know that I can use Arrow Keys to collapse items of solution explorer one by one, but I would like to know if there is a way to collapse all items with only one operation. I want to know it because, today I have a solution with 6 projects that have at least two hundred files and if I try to collapse them one-by-one I will have a hard time.
.Net Solutions
Solution 1 - .Net
Solution 2 - .Net
If you have ReSharper installed, you can right click on the solution in the solution explorer, and select "Collapse All".
Solution 3 - .Net
You can use PowerCommands for Visual Studio 2008
Right click on the project\solution on the solution explorer and choose Collapse Project:
Solution 4 - .Net
Just use the number pad's Plus + and Minus - keys at the top-level node, to expand and collapse respectively (Note: * also expands the whole list.)
For the toolbox, you need to use * and / instead for expand/collapse. Go figure.
Solution 5 - .Net
Solution 6 - .Net
If you have Resharper installed, there is an option called Collapse All and a shortcut key next to it.
Now this shortcut key will not work for you ! Unless you set it up using Tools > Options > Keyboard
.
The command name is ReSharper_CollapseInSolutionExplorer
.
Search using this command name and assign a shortcut key of your choice.
and you now have a shortcut key ready to use to collapse all items in your solution explorer.
I know I am a little late to this discussion, but this surely gonna help some one or other.
Solution 7 - .Net
There's a macro at http://geekswithblogs.net/scottkuhl/archive/2007/04/09/111195.aspx for Visual Studio 2005.
Solution 8 - .Net
The VisualStudio extension CodeMaid provides collapsing.
Download from VisualStudioGallery.
The current version only supports VS2010 or higher, but you can install older versions side-by-side.
Solution 9 - .Net
Using Visual Studio 2017 and above
use shortcut
- Open Tools > Options or press Alt + T + O
- Under Environment tab > Keyboard (Also, you can create a shortcut for Tools.CustomizeKeyboard to open it directly)
To Collapse All
- Search for "SolutionExplorer.CollapseAll"
- Add a new shortcut for example Ctrl+Left Arrow,Ctrl+Left Arrow
To Expand All
- Search for "SolutionExplorer.Folder.CollapseAll"
- Add a new shortcut for example Ctrl+Right Arrow,Ctrl+Right Arrow
-
Assign > OK
Solution 10 - .Net
Visual Studio 2012 is out on 8/15/2012, so I suggest upgrading to that to get a fast "Collapse All" toolbar button previously available only in the Productivity Power Tools' Solution Navigator, which was sometimes too slow to be usable.
Solution 11 - .Net
take a look on this
http://visualstudiogallery.msdn.microsoft.com/en-us/7272073b-32d4-4a84-93f7-77d09fb16f01
Solution 12 - .Net
Use the Visual Studio extension that fits your version of Visual Studio. In my case (I use Visual Studio 2012) I use the extension Productivity Power Tools, but, unfortunately this exist only for VS 2010 and latter... For VS 2008 there is a similar extension: Power Commands.
Solution 13 - .Net
Delete the *.suo
and *.csproj.user
files, and reopen the solution/projects.