views:

3505

answers:

5

I have a vs 2008 solution and I would like to include a real folder in the solution, but not at the project level, instead at the solution level.

I noticed you can right click the solution and add a solution folder, but it comes up as some white folder, and I have my doubts as to exactly what it is supposed to be...

basically on the file system I have c:\mySolution\myFolder....

I want that myFolder added to the solution, so that items are also under source control...

thanks for the help

A: 

I have to also add - this http://msdn.microsoft.com/en-us/library/haytww03(VS.80).aspx is not really what I am interested in.

I would like a real folder included in the solution, for holding files, not for holding projects

Michael L
A: 

You can also add standalone files in a solution folder, and they will be source-controlled. But be wary that VS tends to put these files in the same folder as the solution file - the "Solution Folders" are virtual and don't corresspond to real filesystem folders. To have a real filesystem folders I think you would have to create the structure yourself and then choose "Add Existing Item".

Vilx-
+1  A: 

You can use a solution folder to group files in a solution, but a solution folder doesn't represent an on disk folder, like its logo suggests. (It can contains file references and project references)

Bert Huijben
+1  A: 

What I have done historically is to create a project for just holding files (DLLs, etc.)

You can do that as well. This project can be named as whatever folder you are trying to create.

Vaibhav
+1 that is what I do.
kenny
Its functional, but it does add one more project to the solution, and in a large project, I am trying to slim down on clutter
Michael L
+9  A: 

I also would like to be able to add physical folders to a solution, but unfortunately you can't do so outside a project.

The best solution I have found is to add a solution folder with the same name as the physical folder (myFolder in your example), then add files from that physical folder to the solution folder.

However Visual Studio does not maintain a mapping between the solution folder and the physical folder which means that:

  • new files subsequently created in the solution folder using Visual Studio are not automatically placed in the physical subfolder (I think they are created in the solution root folder by default)

  • files added to the physical folder are not automatically visible in the solution folder, even with "Show All Files".

To add new files, I therefore always create the new file in the physical folder outside Visual Studio, then add it to the solution folder using "Add/Existing Item"

Joe
In addition to the above "which means" list: renaming files in solution explorer will not work as (perhaps) expected. What I do (VS2010): rename in physical folder, add to solution, remove file with old name from solution.
Gerard