Saturday, October 24, 2009

Performance Improvement Tip for Large Projects in Visual Studio

While working on solutions in Visual Studio, it is often the case that you have many projects contained within the solution.  Even on fast machines, Visual Studio performance can start to drag when you begin working on the solution.  In my past experience, I have found that I typically work on only a few projects at a time.  I found that unloading the  unnecessary projects can help to conserve memory.  So how do you unload a project from a solution in Visual Studio?  Simple, just right-click on the project name and click Unload Project.

image

The unloaded projects will appear grayed out along with the text (unavailable).

image

This trick also works well if your code is under source control.  As far as I can tell, the unload/load state of any given project is stored in the corresponding *.SUO file for a solution so this change won’t be tracked by your source control client.

If you are a ReSharper user (and you should be), you know that ReSharper can consume lots of memory while indexing the various symbols.  When you unload a project, ReSharper will ignore files from these projects.  I also find this particularly useful because files with similar names will no longer show up in your quick search lists.

This tip is fairly trivial, but I have never once seen someone do this in practice.  I hope this helps!