BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Collapsing Projects in Visual Studio Solutions

by Benjamin Nitschke 13. January 2010 11:09

DeltaEngine VS Collapse

If you have 50+ projects in a single solution it can be annoying that you cannot collapse them all with a single click or keystroke. Expanding everything can be simply done with Numpad * at any node in the solution explorer. Having so many projects in a solution and compiling them all everytime you F5 something is not such a good idea because compile time goes through the roof (even though each single project is compiled really quickly, usually in much less than a second). Please note that our projects are mostly very simple and having so many projects is by design because they only implement certain features and can be easily replaced (or there are several modules for the same feature, just doing differently or for different platforms). We should blog about that too, I think it is a pretty good idea and makes refactoring and multiplatform development much easier than big projects and lots of ugly defines (we have almost no defines right now and are pretty happy with it).

 

To solve this we have a little helper tool that recursively selects the projects you need for any given project you want to work on, then you end up with 3-4 projects instead of 50+ (we have like 10-20 new projects every month, so this will probably increase for a while). An alternate solution is to fiddle with the build settings in the Configuration Manager to just compile some projects, but not the rest. But this is very error prone and can cause many headaches because you forgot to compile some project you changed some little thing and then your code will still execute the old .dll with the old code missing your newly implemented functionality.

 

But the problem with so many projects, and usually in any kind of Visual Studio solution, is that you cannot easily collapse all projects at once. Instead you have to collapse them one by one, which can be fun with 5 projects, but it is certainly not funny with 50+ projects anymore and you practically have to do it every day to keep the solution explorer short and tidy. Luckily some clever people solved this problem many years ago with macros or extensions and I like the simple macro version. There is a great tutorial with all required steps available, which you can use to set it up for your Visual Studio. We use a slightly modified macro that works better with our sub folders that have projects too:

 

Imports System
Imports EnvDTE
Imports System.Diagnostics

Public Module Collapse
    Sub CollapseAll()
        ' Get the the Solution Explorer tree
        Dim UIHSolutionExplorer As UIHierarchy
        UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
        ' Check if there is any open solution
        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
            ' MsgBox("Nothing to collapse. You must have an open solution.")
            Return
        End If
        ' Get the top node (the name of the solution)
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
        UIHSolutionRootNode.DTE.SuppressUI = True
        ' Collapse each project node
        Dim UIHItem As UIHierarchyItem
        For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
            'UIHItem.UIHierarchyItems.Expanded = False
            If UIHItem.UIHierarchyItems.Expanded Then
                Collapse(UIHItem)
            End If
        Next
        ' 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.
        UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
        UIHSolutionRootNode.DTE.SuppressUI = False
    End Sub

    Private Sub Collapse(ByVal item As UIHierarchyItem)
        ' Recursively collapse
        For Each eitem As UIHierarchyItem In item.UIHierarchyItems
            If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
                Collapse(eitem)
            End If
        Next

        ' First try to collapse
        item.UIHierarchyItems.Expanded = False

        ' Check if it failed, if yes, then do it manually
        If item.UIHierarchyItems.Expanded = True Then
            item.Select(vsUISelectionType.vsUISelectionTypeSelect)
            DTE.ToolWindows.SolutionExplorer.DoDefaultAction()
        End If
    End Sub
End Module

Comments


1/29/2010 8:49:00 PM #

The men who succeed are the efficient few. They are the few who have the ambition and will power to develop themselves.

fast advance | Reply



2/18/2010 6:16:17 PM #

nice post, thanks

Cleaning an Lcd Tv Screen | Reply



3/11/2010 1:10:14 AM #

Interesting post and I really like your take on the issue. I now have a clear idea on what this matter is all about. Thank you so much.

arac sorgulama | Reply



3/25/2010 11:10:39 PM #

You always pass failure on the way to success.

acai berry select | Reply



4/10/2010 8:12:27 PM #

thaks for the share

yokser | Reply



4/13/2010 12:46:25 PM #

Interesting post and I really like your take on the issue. I now have a clear idea on what this matter is all about. Thank you so much.the herbal products are to be sale in discount interesting people can come to see.they provide the best services.

vitamin | Reply



4/13/2010 2:04:47 PM #

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Hard to Find Electronic Parts | Reply



4/14/2010 7:20:17 AM #

You got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.if u need a good skin care just proceed to them.. i have taken care of my skin from them u can also have best skin care.

firming skin care | Reply



4/14/2010 10:00:35 AM #

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.They have a great hand in Helping with writing your essay, coursework, assignment, Dissertation Writing etc..More than Ten Years Experience. Years of productive relations with clients.

Buy Essay | Reply



4/14/2010 9:13:34 PM #

Hello, good luck for me I was looking for this information for several months ago. Finally I got it all here. Thanks a lot!

22 lcd monitor | Reply



4/15/2010 9:22:01 AM #

I’ve been reading a few posts and genuinely and enjoy your writing. I’m just starting up my own blog and only hope that I can write as well and give the reader so significantly insight.

make a website | Reply



4/18/2010 1:29:00 PM #

Great post! Thanks for the information

us | Reply



4/18/2010 1:30:02 PM #

Top post. I look forward to reading more. Cheers

us | Reply



4/18/2010 2:29:14 PM #

I was very impressed. Thank you dear. You are very good. The article was nice to read and full of meaning full of knowledge

us | Reply



4/18/2010 3:05:37 PM #

Hi, I’ve been a lurker around your blog for a few months. I love this article and your entire site! Looking forward to reading more!

us | Reply



4/18/2010 3:42:07 PM #

Thanks for sharing a nice info.

us | Reply



4/18/2010 4:25:37 PM #

Great post! Thanks for the information

us | Reply



4/19/2010 7:05:29 PM #

Really interesting articles. I enjoyed reading it. Are these genuine images or has the artwork been touched up they are truly. Thanks for sharing a nice info.

us | Reply



4/19/2010 7:10:22 PM #

Excellent blog post, I look forward to reading more.

us | Reply



4/20/2010 6:54:32 AM #

I like it very much especially the information you have putted here is like training. Keep the blog up to date. Thanks a lot.

mbt sale | Reply



4/20/2010 10:44:07 AM #

The blog is in reality the great on this worthy subject. I match in together with your conclusions and looking forward to your coming updates. Just saying thanks will not just be enough, for the fantastic clarity inside your writing. I put a link to your blog at my site, hope you dont mind?

adjustable beds frame | Reply



4/20/2010 2:39:44 PM #

Interesting post and I really like your take on the issue.  I now have a clear idea on what this matter is all about. Thank you so much.

executive book summaries | Reply



4/20/2010 2:45:26 PM #

I must say that this is a great post..Really i am impressed from this post....the person who create this post it was a great human. I put a link to your blog at my site, hope you dont mind?

Watch Hot Movies Online | Reply



4/21/2010 7:27:04 PM #

Hi there, possibly u could help me? I saw you are using Blog Engine on your site. I lately decided to create a blog for myself and i am  trying to use a wordpress blog. I read about blogengine and i was thinking maybe you could tell me where i could find helpful training or videos on how to use it properly? Thanks!

Russel Wubben | Reply



4/22/2010 3:41:30 AM #

one day i went shopping outside,and in an ed hardy store,I found some kinds of ed hardy i love most they are Your website is really good Thank you for the information

ed hardy | Reply



4/23/2010 3:12:53 AM #



I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

auto insurance | Reply



4/23/2010 7:35:45 PM #

The best is yet to be.

no fax payday loans | Reply



4/24/2010 9:33:12 AM #

Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.

drills cordless | Reply



4/27/2010 10:02:45 PM #

I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!

Rapidshare | Reply



4/28/2010 1:59:28 PM #

Superb article ,I really appreciated with it,This is nice to read and valuable for future,I really bookmark it ,for further read.Thanks for sharing.I like it.

Eyelastin | Reply



4/29/2010 10:22:40 AM #

I must say that this is a great post..Really i am impressed from this post....the person who create this post it was a great human. I put a link to your blog at my site, hope you dont mind?

Prudential West | Reply



4/30/2010 6:40:40 AM #

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Prudential West | Reply



4/30/2010 11:46:54 AM #

I wasn't afraid to fail. Something good always comes out of failure.

fast payday loans | Reply



5/3/2010 8:42:40 AM #

Can I deduct a business mortage payment or only the interest and why?

Investment properties | Reply



5/3/2010 9:54:54 AM #

I will not debate with your conclusions because I think you're exact on the money! You have put together a valid case for your sentiments and now I know more about this unusual topic

Hotels in Rome | Reply



5/3/2010 10:44:56 PM #

The important thing is not to stop questioning.

payday loans | Reply



5/4/2010 7:15:18 AM #

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject

free stuff | Reply



5/4/2010 3:04:49 PM #

What I liked about her, she didn't give you a lot of horse manure about what a great guy her father was.

Links of London Jewellery | Reply



5/5/2010 3:16:03 AM #

hello there
I posted your blog to my facebook group
Regards

tattoo removal cream | Reply



5/7/2010 4:21:51 PM #

This article gives the light in which we can observe the reality. this is very nice one and gives in depth information. thanks for this nice article Good post.....Valuable information for all.I will recommend my friends to read this for sure…

how much compensation for wiplash | Reply



5/10/2010 10:25:05 AM #

Admiring the time and effort you put into your blog and detailed information you offer! I will bookmark your blog and have my children check up here often. Thumbs up!

debt solution | Reply



5/13/2010 1:20:19 PM #

This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice

trust deeds | Reply



5/20/2010 4:39:34 AM #

I really enjoyed reading through this write-up. I most certainly will be coming back to read some more intriguing ideas. Thank you.

Ed hardy shoes | Reply



5/20/2010 4:39:49 AM #

Your website is great. When is the next post comming on this topic.I'm happy I found this blog,

Canada goose parka | Reply



5/20/2010 1:27:00 PM #

You can even meditate prior to you hit the bed. You realize, fifteen mins of meditation will calm your brain down and assist you rest much better and wake up fresher. So go for it.

spiritual music | Reply



8/30/2011 3:02:14 PM #

Pingback from seagalstevens.wordpress.com

Nags Head, NC ? Hurricane Irene's Effects ? ? Flawlesss News … « seagalstevens

seagalstevens.wordpress.com | Reply



8/30/2011 6:25:31 PM #

Pingback from foreverfriendsquotations.lccarts.org

Noida Web Design Companies Give Your Business the Online Edge … | Forever Friends Quotations

foreverfriendsquotations.lccarts.org | Reply



9/13/2011 5:05:04 AM #

Pingback from alexjudehhh.wordpress.com

Stock Market Performance- Significant Information For Investing In … « alexjudehhh

alexjudehhh.wordpress.com | Reply


Add comment




biuquote
  • Comment
  • Preview
Loading



Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

Poll

Which platform should Soulcraft be released on next?











Show Results Poll Archive

Recent Games

Soulcraft

Fireburst

Jobs @ exDream

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011