Using Solution Folders
Menu: Project -> Add New Solution Folder; [Right-Click Solution] -> Add -> New Solution Folder
Command: Project.AddNewSolutionFolder
Versions: 2008,2010
Published: 3/27/2010
Code: vstipProj0009
Did you know there are special folders to help you organize large solutions? There is! They are called, appropriately enough, Solution Folders. To create one just Right-Click on your solution (or go to Project -> Add New Solution Folder) and you will see this in Solution Explorer:
Simply give the folder a name and you are good to go. But so what? I mean, what can you actually DO with these things? Here is a list of stuff you can do:
Move or add projects to them. Solution Folders can be nested to create greater organizational structure.
Add, delete, or rename Solution Folders at any time, if the organizational requirements of the solution change.
Unload all projects in a Solution Folder to make them temporarily unavailable for building.
Collapse or hide entire Solution Folders so that you can work more easily in Solution Explorer. Hidden projects are built when you build the solution.
- Build or rebuild all the projects. The projects are built in the order specified by the project dependencies.
SPECIAL NOTE:
Solution Folders are an organizational tool in Solution Explorer; corresponding Windows folders are not created. Microsoft recommends that you organize your projects on disk in the same way that you organize them in the solution. But that is your call :)
Comments
Anonymous
March 28, 2010
I can not figure out how to add a policy file for the solution folder so I could turn off building for all projects in an 'archive/review' folder. Am I missing something simple?Anonymous
March 28, 2010
Terry -- I am looking into it now with the VS team and will update when I learn something. :)Anonymous
March 29, 2010
Okay, the official word is in and it is: That comment should not be there. Policies were deprecated a long time ago and this is a documentation error. I've updated the post to reflect the new information and thanks for the great catch Terry! :) ZAnonymous
March 31, 2010
"Solution Folders are an organizational tool in Solution Explorer; corresponding Windows folders are not created. Microsoft recommends that you organize your projects on disk in the same way that you organize them in the solution. But that is your call :) " Since I discovered solution folders a few months ago I have been using them intensively. One of the ways I use them however would conflict with the above advice (and I am therefore happy it is just advice, not enforced). Before I explain, let my emphasize that it is very well possible (and useful, IMHO) that a project can be placed in multiple solutions - right-click on a solution or solution folder and choose "Add|Existing project". I tend to have multiple solutions (all in the same directory) that wrap different subsets of the projects - one big solution wrapping all projects, and then some smaller solutions that only wrap a subset of related projects from that "master solution". The point here is: the way I structure those projects in solution folders tends to be different in different solutions. For instance in a solution whose main purpose is to develop some utility library, that utility library would be at the root, outside any solution folders (and some test related projects for that library would be in the same solution but in a 'tests' solution folder). In contrast, another solution that uses that same library would also contain that library project (but not the tests), but in a solution folder named 'libraries'. And the "master solution" would contain that same library project, but in a solution folder named after that library. If solution folder names were tied to physical disk folders this would not be possible.Anonymous
April 14, 2010
Has this been disabled in 2010? Or perhaps just disabled in the C++ Express version that I'm using.Anonymous
September 28, 2010
how to delete the thing i created by mistake?Anonymous
November 10, 2010
Just right-click and select "Remove" to get rid of folders you don't want :)Anonymous
March 11, 2011
This is a nice start, but if the recommendation from the toolmaker is that the tool be used in a given way (physical == logical) then why isn't a default for that even an optional facet of this feature?Anonymous
June 27, 2011
Hey I cannot see the folder structures in my solution explorer, even though they exist in my source control systemAnonymous
June 27, 2011
Xeno, The folder structures in Solution Explorer are not physical ones, just logical ones. Also, they are stored in the.SUO file which is unique to each person in Visual Studio. The point of Solution Folders is so you can organize items the way YOU want without having to be bound by any physical constructs. Hope this helps :) ZAnonymous
October 05, 2011
"Also, they are stored in the.SUO file which is unique to each person in Visual Studio. The point of Solution Folders is so you can organize items the way YOU want without having to be bound by any physical constructs."
- So if I delete my .suo file, all projects revert back to the root of the solution?
- Also, does reorganising projects in Solution Folders have any (adverse) impact on TFS Source Control? Thanks for your intro into Solution Folders! :-)
Anonymous
November 16, 2011
I am new to solution folders, and programming in general. How would I open a form in my master solution that resides on one of the solution folders? For Example: on a button's handler I would write: Dim aSecondSolutionForm as SecondSolutionForm aSecondSolutionForm.ShowDialog()Anonymous
November 17, 2011
Fernando, Solution Folders are logical constructs that exist in Solution Explorer only and have no impact on the physical location of files. They are just a way to organize things in Solution Explorer. Just access your forms as you normally would :) ZAnonymous
November 17, 2011
Chris, Looks like i missed you questions let me address them real quick:
- Yes, theoretically although the SUO information is stored in other areas as well so it may just regenerate the SUO instead. I haven't found out where these other areas are (or even if they are areas or just one place) but have tried to delete my SUO only to have it regen when I opened the solution again.
- Nope. Zero impact to anything except how you view the information in Solution Explorer. :) Z
- Anonymous
November 18, 2014
Hey I cannot see the folder structures in my solution explorer, even though they exist in my source control system. I I have the same problem HELPPPPP . Thansk from Argentina