问题
Is there a way to collapse all the files at once in the Solution Explorer window in Visual Studio?
回答1:
Use the extension Collapse Solution. Usually, this feature comes with ReSharper, but I presume that you are not using ReSharper.
There are also a lot of macros out there that help you do the same. One of them is in ‘Collapse All’ in Visual Studio.
Note: There is no inbuilt way in Visual Studio to actually achieve this. And considering just how practical it is, I would have thought they would have added this kind of feature way back in Visual Studio 2005 itself. I know people have been asking for it for years. But in their infinite wisdom, Microsoft don't consider it important enough.
回答2:
In visual studio 2013, there is a button in solution explorer - Collapse All
回答3:
I think this extension have requested functionality - PowerCommands for VS 2010. Also Productivity Power Tools contains solution navigator which also have this feature and much more usefull stuff for solution navigation and search.
Edited: there also a lot of examples of macro, doing this stuff.
回答4:
Try free VSCommands 2010 Lite extension. It has this and few other free features.
回答5:
In Visual Studio 2013 you can do it with right click by Solution -> Collapse All
回答6:
Of course, you can collapse any selected node by pressing '-', but I understand you are probably looking to collapse the entire tree.
来源:https://stackoverflow.com/questions/4273552/collapse-all-files-at-once-in-solution-explorer-window-in-visual-studio