Did you know that Visual Studio (VS) contains a great little feature to help logically organize and manage large solutions? This feature was added to VS2005 but, AFAIK, has been flying under the radar.
Solution Management before 2005
Below is the diagram I used to use to explain our VS Project organization strategy (click to enlarge). The advantage of this “Master Solution” technique is that development can be performed inside one of the smaller solutions to improve performance while our automated builds are performed on the master solution. The main drawbacks are:
- You often end up with multiple instances of VS open because you need to reference code in another solution.
- Master solutions with greater than 10-20 projects can be a beast to work with. How many times have you avoided rebooting simply because it takes 5 minutes to open visual studio?
With solution folders, the same solution can be better managed with one master solution file. A solution folder can be created to replace each of the solution files from the diagram above. At the solution folder level you can perform the following:
- Hide/unhide folders (projects in hidden folders are still compiled if they are a dependency of a project which is not hidden).
- Load/unload folders. The projects still remain visible but are disabled and unloaded from memory. ‘Ctrl-Shift-B’ will now only compile the active projects you are currently working with.
- Build at the folder level. Folders contained within the hierarchy will be compiled at the same time.
In addition, when you hide or unload projects within a solution folder, this information is stored within the solution user file (.suo extension) and will not affect other developers on your team because users files do not get checked into the source tree.
Here is a screenshot of VS’s Solution Explorer representing the same master solution diagrammed above with the “Server” projects unloaded: