Question

I have a Visual Studio 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 is added to the solution, so that items are also under source control...

Was it helpful?

Solution

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"

OTHER TIPS

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.

Follow this...

  1. Create the solution folder from Visual Studio.
  2. Right click the solution folder to create a new project.
  3. Change the default location path to add the new physical folder name right after it with the back slash. Something like...C:\Project\Test\New Physical Folder
  4. Click the OK button to create the project

Then the new project will be put inside your new New Physical Folder.

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".

From MSDN:

"If you are working with a solution that contains numerous projects, you can use Solution Folders to organize related projects into groups and then perform actions on those groups of projects."

You don't want what the composer meant in Solution Folder. It made them to organize large solutions into groups.

For your problem, I think this is the job for your Installation Project to collect these files: Installation instructions, Global help, etc...

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 contain file references and project references.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top