我正在使用DPack,因为这会在解决方案资源管理器中向“解决方案”节点添加“折叠所有项目”选项。它工作得很好,但可能需要一段时间才能执行,并不总是完全折叠所有内容。在Visual Studio中折叠所有项目的最佳/最快/最简单的方法是什么?
有没有更好的选择?最好免费且易于安装/设置。有很多,但最好的工作,没有任何错误或性能问题。
我正在使用DPack,因为这会在解决方案资源管理器中向“解决方案”节点添加“折叠所有项目”选项。它工作得很好,但可能需要一段时间才能执行,并不总是完全折叠所有内容。在Visual Studio中折叠所有项目的最佳/最快/最简单的方法是什么?
有没有更好的选择?最好免费且易于安装/设置。有很多,但最好的工作,没有任何错误或性能问题。
对于VS2005,我一直在使用CoolCommands 4.0。 older 3.0 version的功能描述更加完整。 版本3有一个.msi安装程序。版本4是.zip file(这对我的环境来说更容易)。
我最喜欢的功能(完整列表的子集):
Power commands for visual studio将做的伎俩。没有注意到他们的任何性能\稳定性问题。
值得注意的是,这只适用于Visual Studio 2008 – tjrobinson 2008-10-17 10:27:47
这里的特点为CoolCommands 4.0一个更好的列表。
要为VS 2005安装它,请执行include setup.bat。
regpkg CoolCommands.dll /root:Software\Microsoft\VisualStudio\9.0 /codebase
我使用下面的宏这在Visual Studio 2005和Visual Studio 2008的工作原理:
要安装它的VS 2008,从
regpkg CoolCommands.dll /codebase
修改以下行
要建立一个快捷键:
代码
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module CollapseAll
Sub CollapseAll()
' Get the the Solution Explorer tree
Dim solutionExplorer As UIHierarchy
solutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
' Check if there is any open solution
If (solutionExplorer.UIHierarchyItems.Count = 0) Then
Return
End If
' Get the top node (the name of the solution)
Dim rootNode As UIHierarchyItem = solutionExplorer.UIHierarchyItems.Item(1)
rootNode.DTE.SuppressUI = True
' Collapse each project node
Collapse(rootNode, solutionExplorer)
' Select the solution node, or else when you click
' on the solution window
' scrollbar, it will synchronize the open document
' with the tree and pop
' out the corresponding node which is probably not what you want.
rootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
rootNode.DTE.SuppressUI = False
End Sub
Sub CollapseSelected()
' Get the the Solution Explorer tree
Dim solutionExplorer As UIHierarchy
solutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
' Check if there is any open solution
If (solutionExplorer.UIHierarchyItems.Count = 0) Then
Return
End If
' Get the top node (the name of the solution)
Dim selected As Array = solutionExplorer.SelectedItems
If (selected.Length = 0) Then Return
Dim rootNode As UIHierarchyItem = selected(0)
rootNode.DTE.SuppressUI = True
' Collapse each project node
Collapse(rootNode, solutionExplorer)
' Select the solution node, or else when you click
' on the solution window
' scrollbar, it will synchronize the open document
' with the tree and pop
' out the corresponding node which is probably not what you want.
rootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
rootNode.DTE.SuppressUI = False
End Sub
Private Sub Collapse(ByVal item As UIHierarchyItem, ByRef solutionExplorer As UIHierarchy)
For Each innerItem As UIHierarchyItem In item.UIHierarchyItems
If innerItem.UIHierarchyItems.Count > 0 Then
' Re-cursive call
Collapse(innerItem, solutionExplorer)
' Collapse
If innerItem.UIHierarchyItems.Expanded Then
innerItem.UIHierarchyItems.Expanded = False
If innerItem.UIHierarchyItems.Expanded = True Then
' Bug in VS 2005
innerItem.Select(vsUISelectionType.vsUISelectionTypeSelect)
solutionExplorer.DoDefaultAction()
End If
End If
End If
Next
End Sub
End Module
我没有编写这段代码,我不确定这段代码来自哪里,但它的在线版本有所不同。
PowerCommands for Visual Studio将适用于VS2008和VS2010。这是微软支持的方式。
CoolCommands是开源的,所以你可以添加更多的功能:-)。 – AlePani 2008-10-13 03:45:53
托管的开源版本在哪里? – tjrobinson 2009-06-12 09:31:50