I just opened a larger project and decided it was time to reinstall my "CollapseAll" macro. I don't remember where I got this macro originally but it was for the orginal Visual Studio .Net. I found the updated version that I am using here. There is also a slower (but more powerful version) of the macro here. When run, this macro will recursively collapse all files and projects in a solution to make it easier to see the whole solution and find what you are looking for. To install it:
- Open Visual Studio 2005
- Open the Macro Explorer by pressing Alt+F8 or Clicking View > Other Windows > Macro Explorer
- Go to the Macro Explorer tab. In my VS2005 setup, it's in the same area as the Solution Explorer, Class View, etc.
- Right-click and choose "New Macro Project".
- Name the project "CollapseAll".
- (optional)Open the new CollapseAll project and rename the module (I used CollapseAll here too).
- Copy the macro code from one of the sites above into the module.
- Build and Save the Module.
- Close the Macro Explorer
- Open your Visual Studio settings under Tools > Options.
- Click the Keyboard category under Environment in the Options dialog tree.
- Type "CollapseAll" into the textbox under "Show commands containing:". This should filter the list of commands and you should see the namespace for your macro. Mine is called Macros.CollapseAll.CollapseAll.CollapseAll (a bit confusing but oh well.)
- Choose the namespace for your macro in the listbox
- Choose a shortcut to assign this command to and enter it in the "Press shortcut keys:" textbox. I use Alt+C and it works great and doesn't interfere with other commands.
- Click Assign
- Click OK
You should be good to go at this point. Open up a large solution, expand a few items and then press Alt+C (or your shortcut.) The macro usually runs in a second or two and collapses the entire source tree. On big projects, I've found this to be one of the most useful Visual Studio enhancements I've ever used.