Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

July 13, 2010

Solution Folders

Filed under: C#,VB.NET,Visual Studio @ 12:42 pm

If you are working on a large project, your Solution Explorer can get unwieldy and difficult to manage. Solution Folders can help.

Solution folders are logical folder groupings of projects or files within a project.

For example, here is a solution with a set of projects:

image

There are only 11 projects here, which may be small compared to a "real" application, but it will demonstrate the usefulness of solution folders.

To add folders at the solution level to organize your projects:

  1. Click on the solution in Solution Explorer.
  2. Select Add | New Solution Folder.
  3. Give the folder a logical name.
  4. Drag and drop projects in Solution Explorer into the new folder.

Note: This does not create folders in your file system. It only defines logical folders within your solution.

After Step 2, the folder then appears in Solution Explorer:

image 

In this example, we want to move all of the test projects into a folder, so the solution folder is named "Test Projects". The test projects are then dragged to the new folder. The result is shown below:

image

When you aren’t working with your test projects, you can close the folder, making Solution Explorer a little easier to work with.

image

To add folders at the project level to organize your project files:

  1. Click on the project in Solution Explorer.
  2. Select Add | New Folder.
  3. Give the folder a logical name.
  4. Drag and drop project file in Solution Explorer into the new folder.

Note: This does create folders in your file system and moves the dragged files to that folder.

image

In this example, we want to group the python files into their own folder.

The result is shown below:

image

Use this technique any time you want to organize your projects or project files into folders.

Enjoy!

EDIT [7/13/10]: Added a second note to make it clear that folders defined at the solution level do *not* create folders in the file system. Folders defined within a project *do* created folders in the file system.

6 Comments

  1.   Luciano Evaristo Guerche (Gorše) — July 13, 2010 @ 1:35 pm    Reply

    Interesting is that at solution level folders are not created at solution directory and projects are not moved to them) whereas at project level folders are created at disk and artefacts (*.cs, *.vb, *.xaml, etc) moved to them.

  2.   Luciano Evaristo Guerche (Gorše) — July 13, 2010 @ 1:36 pm    Reply

    I have noted this behaviour on VS2008, but believe it remains the same for VS2010.

  3.   DeborahK — July 13, 2010 @ 1:58 pm    Reply

    Hi Luciano –

    I will add a note to the post to clarify this. Thanks!

  4.   Thomas — July 14, 2010 @ 1:54 am    Reply

    You might als want to mention that Microsoft recommends mirroring the Solution Folder structure in the in the Filesystem structure. In your example creating a new folder in the filesystem named ‘Test Projects’ and physically moving the Test Projets there.

  5.   casi royal — October 1, 2011 @ 4:29 pm    Reply

    thanks for sharing this info!

  6.   HabeeburRahman — October 30, 2011 @ 1:03 am    Reply

    Thank you for the info. It is a very useful information.

    In addition, the following advantages are also there:

    1. Solution Folders (SF) can be hidden for easy navigation of other projects – but hidden folders are also included in the build.
    2. SF can be built separately.
    3. SF can be excluded for build.
    4. Nested SF can also be created.

    All these apply to all the projects inside the solution folders.

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2021 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs