Reputation: 5690
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...
Upvotes: 63
Views: 55229
Reputation: 1
Create your Solution
dotnet new sln -n demoProjectName
e.g. Your solution folder path C:\Projects\demoProjectName>
Create a Project within the same solution Path
dotnet new classlib -n Persistence
From your solution folder path, do this
C:\Projects\demoProjectName> dotnet sln C:\Projects\demoProjectName\ add C:\Projects\demoProjectName\Persistence\Persistence.csproj
Please note: Persistence as used is just a placeholder for your project name. classlib for classLibrary projects and it could be a console project and so on.
Upvotes: 0
Reputation: 592
My prefered solution is to add a Shared project, which is like a folder but with a special icon.
Upvotes: 4
Reputation: 3443
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...
Upvotes: 3
Reputation: 998
Follow this...
Then the new project will be put inside your new New Physical Folder
.
Upvotes: 10
Reputation: 19622
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.)
Upvotes: 2
Reputation: 124746
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"
Upvotes: 47
Reputation: 11436
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.
Upvotes: 12
Reputation: 106960
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".
Upvotes: 4