A Software Engineer in the Bay Area. Living Life, Learning Software and Loving Both. RSS Feed


Collapse All Projects in a Visual Studio 2005 Solution

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:

  1. Open Visual Studio 2005
  2. Open the Macro Explorer by pressing Alt+F8 or Clicking View > Other Windows > Macro Explorer
  3. Go to the Macro Explorer tab.  In my VS2005 setup, it's in the same area as the Solution Explorer, Class View, etc.
  4. Right-click and choose "New Macro Project".
  5. Name the project "CollapseAll".
  6. (optional)Open the new CollapseAll project and rename the module (I used CollapseAll here too).
  7. Copy the macro code from one of the sites above into the module.
  8. Build and Save the Module.
  9. Close the Macro Explorer
  10. Open your Visual Studio settings under Tools > Options.
  11. Click the Keyboard category under Environment in the Options dialog tree.
  12. 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.)
  13. Choose the namespace for your macro in the listbox
  14. 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.
  15. Click Assign
  16. 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.

 
Posted by Brian Ellis | 3 Comments | Trackback Url | Bookmark with:        
Tags: Work

Links to this Post

Comments

Wednesday, 25 Jul 2007 04:46 by ... You are the best EVER
We have monster solutions at my work and you have just made my life SO much better. THANK YOU FOREVER!

Friday, 10 Aug 2007 03:18 by Re: Collapse All Projects in a Visual Studio 2005 Solution
Very nice. Thanks!

Wednesday, 22 Aug 2007 01:04 by Woop woop
Super stuff - works like a charm. Cheers

Name:
URL:
Email:
Comments:

CAPTCHA Image Validation