Home > OS >  How to put projects in one folder in a Visual Studio solution
How to put projects in one folder in a Visual Studio solution

Time:11-28

I did some problem-solving in C , and the current file structure looks like this.

solution_folder/
├── question_1/
│   ├── Main.cpp
│   ├── question_1.vcxproj
│   └── question_1.vcxproj.filters
├── question_2/...
├── (more project folders)
└── solution.sln

I want to put all projects in one folder and still be able to open the solution in Visual Studio just as I used to before. I don't want to scroll through hundreds of folders to get to the readme section when I upload the solution on GitHub.

solution_folder/
├── src/
│   ├── question_1/
│   │   ├── Main.cpp
│   │   ├── question_1.vcxproj
│   │   └── question_1.vcxproj.filters
│   ├── question_2/...
│   └── (more project folders)
└── solution.sln

Is this possible? Should I not create a project for each question?

CodePudding user response:

As @drescherjm and @heapunderrun commented,

  1. Put all project folders in one folder in File Explorer,
  2. Remove all projects from the solution in Solution Explorer,
  3. Right-click on the solution and Add → Existing Project all projects.

Update:

Shortcuts

  • Remove: Delete
  • Add existing project: Alt F D E
  • Related