Visual Studio:有没有办法折叠解决方案资源管理器的所有项目?
我知道我可以使用箭头键将解决方案资源管理器的项目逐一折叠,但我想知道是否有一种方法只需一次操作即可折叠所有项目。我想知道这一点,因为今天我有一个包含 6 个项目的解决方案,这些项目至少有两百个文件,如果我尝试将它们一一折叠,我将遇到困难。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
从 Visual Studio 2013 开始,它似乎是默认内置的。
It appears to be built in by default in Visual Studio 2013 onwards.
如果安装了 ReSharper,则可以右键单击解决方案资源管理器中的解决方案,然后选择“全部折叠”。
If you have ReSharper installed, you can right click on the solution in the solution explorer, and select "Collapse All".
您可以使用 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:
只需在顶级节点使用数字键盘的加号 + 和减号 - 键即可展开和 分别折叠(注意: * 也会展开整个列表。)
对于工具箱,您需要使用 * 和 / 代替展开/坍塌。去算算吧。
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.
在 VS 2019 中,只需单击全部折叠
In VS 2019 just click Collapse All
如果您安装了 Resharper,则会有一个名为“全部折叠”的选项,并且旁边有一个快捷键。
现在这个快捷键对你不起作用!除非您使用
Tools > 设置它选项>键盘
。命令名称为
ReSharper_CollapseInSolutionExplorer
。使用此命令名称进行搜索并分配您选择的快捷键。
现在,您可以使用快捷键来折叠解决方案资源管理器中的所有项目。
我知道我对这个讨论有点晚了,但这肯定会对某人有所帮助。
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.
使用 Visual Studio 2017 及更高版本
使用快捷方式
(此外,您可以为 Tools.CustomizeKeyboard 创建快捷方式以直接打开它)
全部折叠
添加一个新的快捷键,例如 Ctrl+向左箭头、Ctrl+向左箭头
全部展开
添加新快捷方式,例如 Ctrl+ 向右箭头,Ctrl+向右箭头
分配 > 确定
Using Visual Studio 2017 and above
use shortcut
(Also, you can create a shortcut for Tools.CustomizeKeyboard to open it directly)
To Collapse All
Add a new shortcut for example Ctrl+Left Arrow,Ctrl+Left Arrow
To Expand All
Add a new shortcut for example Ctrl+Right Arrow,Ctrl+Right Arrow
Assign > OK
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.
有一个宏
There's a macro at Link for Visual Studio 2005.
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.
看看这个
http://visualstudiogallery.msdn.microsoft.com/en -us/7272073b-32d4-4a84-93f7-77d09fb16f01
take a look on this
http://visualstudiogallery.msdn.microsoft.com/en-us/7272073b-32d4-4a84-93f7-77d09fb16f01
现在在 Visual Studio 2022 17.7 版本中非常简单。它更容易、更灵活。
当您右键单击解决方案资源管理器中的节点时。您可以使用它来折叠所选节点及其后代节点。我们还通过 Ctrl+向左箭头键将其映射为快捷方式。
参考: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.
Reference: https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#collapse-all-descendants-for-solution-explorer
使用适合您的 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.
删除
*.suo
和*.csproj.user
文件,然后重新打开解决方案/项目。Delete the
*.suo
and*.csproj.user
files, and reopen the solution/projects.