.net Visual Studio:有没有办法折叠解决方案资源管理器的所有项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1357731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:14:49  来源:igfitidea点击:

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

.netvisual-studio-2008

提问by Cleiton

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 filesand if I try to collapse them one-by-one I will have a hard time.

我知道我可以使用箭头键一个一个地折叠解决方案资源管理器的项目,但我想知道是否有一种方法可以只用一个操作折叠所有项目。我想知道它是因为,今天我有一个包含 6 个项目的解决方案,其中至少有200 个文件,如果我试图将它们一个一个地折叠起来,我将很难过。

Tree View - Solution Explorer (Visual Studio)

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

回答by Sebastian Patten

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

它似乎默认内置在 Visual Studio 2013 中。

Solution Explorer >Collapse

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

回答by Pete

If you have ReSharper installed, you can right click on the solution in the solution explorer, and select "Collapse All".

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

回答by HuBeZa

You can use PowerCommands for Visual Studio 2008

您可以使用PowerCommands for Visual Studio 2008

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

右键单击解决方案资源管理器上的项目\解决方案,然后选择折叠项目:

回答by AL.

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.

对于工具箱,您需要使用* / 代替展开/折叠。去搞清楚。

回答by Yasser Shaikh

As you can see in the screenshot below, there is an option called Collapse All and a shortcut key next to it.

正如您在下面的屏幕截图中看到的那样,有一个名为“全部折叠”的选项,旁边还有一个快捷键。

Solution Explorer >Resharper >Collapse

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

Now this shortcut key will not work for you ! Unless you set it up using Tools > Options > Keyboard.

现在这个快捷键对你不起作用!除非您使用Tools > Options > Keyboard.

The command name is ReSharper_CollapseInSolutionExplorer.

命令名称是ReSharper_CollapseInSolutionExplorer.

Search using this command name and assign a shortcut key of your choice.

使用此命令名称进行搜索并指定您选择的快捷键。

Options >Keyboard >ReSharper_CollapseInSolutionExplorer

选项 >键盘 >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.

我知道我对这个讨论有点晚了,但这肯定会对某些人有所帮助。

回答by Em1

The VisualStudio extension CodeMaidprovides collapsing.

VisualStudio 扩展CodeMaid提供折叠功能。

Downloadfrom VisualStudioGallery.

从 VisualStudioGallery下载

The current version only supports VS2010 or higher, but you can install older versions side-by-side.

当前版本仅支持 VS2010 或更高版本,但您可以并排安装旧版本。

回答by TLiebe

回答by Anas Alweish

Using Visual Studio 2017 and above

使用 Visual Studio 2017 及更高版本

use shortcut

使用快捷方式

  • Open Tools> Optionsor press Alt+ T+ O
  • Under Environmenttab > Keyboard(Also, you can create a shortcut for Tools.CustomizeKeyboardto open it directly)
  • 打开 工具>选项或按Alt+ T+O
  • 环境选项卡>键盘下(另外,您可以为Tools.CustomizeKeyboard创建快捷方式以直接打开它

To Collapse All

全部折叠

  • Search for "SolutionExplorer.CollapseAll"
  • Add a new shortcut for example Ctrl+Left Arrow,Ctrl+Left Arrow

  • 搜索“ SolutionExplorer.CollapseAll
  • 添加一个新的快捷方式,例如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

    enter image description here

  • Assign> OK

  • 搜索“ SolutionExplorer.Folder.CollapseAll
  • 添加一个新的快捷方式,例如Ctrl+ Right Arrow, Ctrl+Right Arrow

    在此处输入图片说明

  • 分配> 确定

回答by Patrick Szalapski

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.

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