What's the upper limit on the number of projects within VS2005?
I had a friend whose team said:
"...most of them have 1GB of RAM and Pentium 4 3.0Ghz HT CPU’s. hey are all complaining about performance, especially with build times. Visual Studio is eating up most of the memory on their systems. Right now those with 1GB of RAM are generally running around 1.2GB of memory usage, so they are swapping like crazy and thus adding even more overhead. There are a couple systems with 2GB of RAM with Core Duo CPU’s. These systems are having the same issues where they are using 2.2GB of RAM, most of which is meaning eaten up by Visual Studio."
And I asked...
"Do they have too many projects in their solution?"
and he said...
"They said 50 projects and growing."
...and Scott Guthrie posted last week on optimizing build times in VS 2005.
"1.2GB RAM usage is pretty out there...50 large projects will strain a system depending on what they are doing. They should look hard at whether they really need all 50 in one solution. Multiple solutions (even with multiple instances of VS running) work great too."
Clarifying Update from ScottGu:
You should be able to load 50 projects in a single solution - my comment in the origional mail wasn't to imply that you can't. It was more than 1.2GB of RAM to-do so is larger than I would expect (unless each project is large and there are lots of cross project references).
Editoral: That makes me suspect Resharper as the issue in this case..
As an aside, they were also running Resharper at the same time, and it's currently unclear how much memory was being used by Resharper's on-the-fly analysis. I'll post if I learn more.
Nutshell: Try to break your projects up into reasonably sized subsystems that can build separately. Our SDK has about six solutions, each with about 10 projects.
If you're running VB and you're hitting the VB-specific problem with large projects, you can get a HotFix here.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Putting these three EXEs into a single SLN also makes it easier as new projects are created: only one SLN needs to be modified rather than three.
What we really want is something along the lines of “nested SLNs”, SLNs could then be organized in logical groups (say all of the Web Reference assemblies) of about a dozen projects and those SLNs could be added to other SLNs. I’m sure there’s ways to make this work using MSBUILD, but we like using the Visual Studio IDE.
Don't get me wrong - I love it bits and wouldn't be without it but it is memory hungry and can cause memory exceptions (although this rarely crashes VS - just pops up a dialog)
Cheers
Simon
One thing to check is the difference with and without Resharper installed (or any other additional package). It is possible that this is contributing to the slowdown.
Hope this helps,
Scott
Gordon
When I am working on part of the solution, .e.g one of the many applications it contains, I can unload the projects I know I don’t need.
It’s a pity that I can not have a named group of projects that I can load in a single step, or automatically unload all projects that are not needed by a given application. But still be able to build the COMPLETE solution when I wish to.
It'd be great if an MS dev got bit by the R#R bug enough to help them with memory aspects of perf, because the product is a real high value add on to Studio. (makes me glad I bought it back on version 1...)
I work on the Visual Studio Tools Platform team... We're very much interested in finding out whether the memory usage is due to Resharper or to something else -- I haven't seen too many instances where opening a 50 project solution should consume as much memory as you indicate.
Can you email me back at izzyg@microsoft.com -- I can forward to you a mini-tool that we've written to collect information on memory allocations. Your friend can then easily run this tool, and if they forward us the log, we can find out what is allocating so much memory and hopefully suggest some solutions.
Thanks,
-- Izzy
Izzy Gryko
Lead Software Engineer, Visual Studio Tools Platform
izzyg@microsoft.com
I've seen solutions that were smart client solutions where web services, common libraries and everything else needed were inside of the main smart client solution along with everything else. A web service the smart client relies on is going to be deployed seperate than the smart client. So as a rule, we would treat the web service as its own solution. It helps to keep things seperate and allows different members of the team to work on different layers of the overall project (web services, asp.net documentation, front-end GUI, common libraries) at different times.
As this is mostly unbearable for normal development, I have developed the following trick - called "stripped down solution":
1. Get the whole source code for the solution.
2. Build the solution. I use "msbuild official.sln" from the command line.
3. Create a new solution. I have an item in my Explorer/New menu for that.
4. Open the new solution and add just those projects you plan to develop in. Usually this is the production project and the test project.
Why does this work?
When the solution has been built, all the references between projects in the solution are pointing to the assemblies in the build output of the referenced project. This is accomplished by step 2.
When you remove a project from a solution all the references to that project are removed from the referencing projects. So we do it the other way around: We start with an empty solution and just add the things we want to change.
You might get worried when you look at the list of references in the Solution Explorer: some of the references show a warning sign. You can ignore that almost all of the time. Your solution will work as expected.
Some additional remarks.
Why the mega-solution?
-> It binds together all the visual studio projects we want to build at once.
Are there situations where the stripped down solution does not work?
-> Yes! When you rename an identifier, automatic renaming applies only to the projects within the current solution. So for that you will need the mega-solution again.
-> Adding project references. You obviously will need the mega solution to do that.
Do you check in the stripped down solutions?
-> No! The stripped down solutions are tailored to the developer and the task at hand. The stripped down solution I am using today will have little relevance for some other developer next week.
Maybe this will work with unloading the projects as well, but I have not tried this yet.
Comments are closed.
Seems like that's a complete violation of encapsulation. Please tell me we're not letting devs make ad-hoc changes in any of those 50 projects?
I'd say performance at this point is a BLESSING (and not at all blamable on VS 2005) as it might encourage some rethinking of overall process.