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

发布于 2024-08-03 15:14:20 字数 234 浏览 2 评论 0原文

我知道我可以使用箭头键将解决方案资源管理器的项目逐一折叠,但我想知道是否有一种方法只需一次操作即可折叠所有项目。我想知道这一点,因为今天我有一个包含 6 个项目的解决方案,这些项目至少有两百个文件,如果我尝试将它们一一折叠,我将遇到困难。

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

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.

Tree View - Solution Explorer (Visual Studio)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

与往事干杯 2024-08-10 15:14:20

从 Visual Studio 2013 开始,它似乎是默认内置的。

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

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

Solution Explorer > Collapse

2024-08-10 15:14:20

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

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

千纸鹤 2024-08-10 15:14:20

您可以使用 Visual Studio 2008 的 PowerCommands

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

You can use PowerCommands for Visual Studio 2008

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

分分钟 2024-08-10 15:14:20

只需在顶级节点使用数字键盘的加号 + 和减号 - 键即可展开和 分别折叠(注意: * 也会展开整个列表。)

对于工具箱,您需要使用 * / 代替展开/坍塌。去算算吧。

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.

旧情别恋 2024-08-10 15:14:20

在 VS 2019 中,只需单击全部折叠

在此处输入图像描述

In VS 2019 just click Collapse All

enter image description here

远山浅 2024-08-10 15:14:20

如果您安装了 Resharper,则会有一个名为“全部折叠”的选项,并且旁边有一个快捷键。

解决方案资源管理器> Resharper > Collapse

现在这个快捷键对你不起作用!除非您使用 Tools > 设置它选项>键盘

命令名称为 ReSharper_CollapseInSolutionExplorer

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

选项 >键盘 > ReSharper_CollapseInSolutionExplorer

现在,您可以使用快捷键来折叠解决方案资源管理器中的所有项目。

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

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

Solution Explorer > Resharper > Collapse

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.

Options > Keyboard > 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.

︶葆Ⅱㄣ 2024-08-10 15:14:20

使用 Visual Studio 2017 及更高版本

使用快捷方式

  • 打开工具> 按Alt + T + O
  • 选项或在环境选项卡下 键盘
    (此外,您可以为 Tools.CustomizeKeyboard 创建快捷方式以直接打开它

全部折叠

  • 搜索“SolutionExplorer.CollapseAll” "
  • 添加一个新的快捷键,例如 Ctrl+向左箭头Ctrl+向左箭头

全部展开

  • 搜索“SolutionExplorer.Folder.CollapseAll
  • 添加新快捷方式,例如 Ctrl+ 向右箭头Ctrl+向右箭头

    在此处输入图像描述

  • 分配 > 确定

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

    enter image description here

  • Assign > OK

岁吢 2024-08-10 15:14:20

VisualStudio 扩展 CodeMaid 提供折叠功能。

从 VisualStudioGallery 下载

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

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.

梦萦几度 2024-08-10 15:14:20

有一个宏

There's a macro at Link for Visual Studio 2005.

勿忘初心 2024-08-10 15:14:20

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

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.

落墨 2024-08-10 15:14:20

现在在 Visual Studio 2022 17.7 版本中非常简单。它更容易、更灵活。

当您右键单击解决方案资源管理器中的节点时。您可以使用它来折叠所选节点及其后代节点。我们还通过 Ctrl+向左箭头键将其映射为快捷方式。

来自一个YouTube 频道

参考https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#collapse-all-descendants-for-solution-explorer

It’s very simple now in visual studio 2022 17.7 version. It’s easier and more flexible.

When you right-click on a node in Solution Explorer. You can use this to collapse the selected node as well as its descendent nodes. We've also mapped this as a shortcut via the Ctrl+Left arrow keys.

from one YouTube channel

Reference: https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#collapse-all-descendants-for-solution-explorer

许久 2024-08-10 15:14:20

使用适合您的 Visual Studio 版本的 Visual Studio 扩展。
就我而言(我使用 Visual Studio 2012),我使用扩展 生产力电动工具,但是,不幸的是,这只存在于 VS 2010 及更高版本...对于 VS 2008,有一个类似的扩展: 电源命令

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.

不寐倦长更 2024-08-10 15:14:20

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

Delete the *.suo and *.csproj.user files, and reopen the solution/projects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文