简体   繁体   中英

Visual Studio: Is there a way to collapse all items of Solution Explorer?

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.

树视图 - 解决方案资源管理器 (Visual Studio)

It appears to be built in by default in Visual Studio 2013 onwards.

解决方案资源管理器 > 收起

如果您安装了 ReSharper,您可以在解决方案资源管理器中右键单击解决方案,然后选择“全部折叠”。

You can use PowerCommands for Visual Studio 2008

Right click on the project\\solution on the solution explorer and choose Collapse Project:

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.

If you have Resharper installed, there is an option called Collapse All and a shortcut key next to it.

解决方案资源管理器 > Resharper > 折叠

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.

选项 > 键盘 > ReSharper_CollapseInSolutionExplorer

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.

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.

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

In VS 2019 just click Collapse All

在此处输入图片说明

Visual Studio 2012 将于 2012 年 8 月 15 日发布,因此我建议升级到该版本以获得一个快速的“全部折叠”工具栏按钮,以前仅在 Productivity Power Tools 的解决方案导航器中可用,有时速度太慢而无法使用。

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 .

删除*.suo*.csproj.user文件,然后重新打开解决方案/项目。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM