Matt Spradley
Matt Spradley

Reputation: 8444

What is the best location for solution file in Visual Studio?

I prefer for the solution file to be in the same folder as the project files in Visual Studio. I know this is accomplished by unchecking the "Create directory for solution" checkbox. However, VS 2008 defaults to having the box checked.

I am interested in other people's opinions on whether the solution file should live in the same directory.

Upvotes: 28

Views: 34972

Answers (2)

ChrisW
ChrisW

Reputation: 56123

When a solution contain more than one project, I like a solution file in a parent directory and the project files in its child directories.

When a solution contains many projects (my current solution has 36 projects/assemblies), then I'll have:

  • Grandparent: solution
  • Child directories: "solution folders" which are logical collections of projects
  • Grandchildren: the projects themselves

I also agree with having the solution and its project in the same folder, if the solution only has one project. And if you start like this and want to add another project to the solution later, it's easy to change (e.g. create a new solution in a parent directory or move your existing solution, and add/re-add the existing project to it).

Just don't put several projects in the same folder.

Upvotes: 41

Arnis Lapsa
Arnis Lapsa

Reputation: 47677

I prefer it something like this:

MyProject
  src
    Domain
    Application
    Infrastructure
    UI
  solutions
    MyProject
    Infrastructure
    Domain

Solutions folder contains solution folders. All projects are referenced from src folder.

Upvotes: 2

Related Questions