Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 697
Matt Spradley Avatar asked May 24 '09 21:05

Matt Spradley


People also ask

Where are solutions stored Visual Studio?

When you create a new project, Visual Studio saves it to its default location, %USERPROFILE%\source\repos. To change this location, go to Tools > Options > Projects and Solutions > Locations. For more information, see Options dialog box: Projects and Solutions > Locations.

Should you place solution and project in the same directory?

Creating a Solution NET will create a new solution with the same name as the project, placing the solution files in the same directory as the project. Although this works fine for small projects, it isn't well suited to more complex applications.

What is a solution folder in Visual Studio?

A solution folder is a container for one or more related projects. You can create many folders within a Visual Studio solution, including nested folders. They appear in the Solution Explorer as expandable and collapsible sections.

How do I change the location of a solution in Visual Studio?

In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.


2 Answers

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.

like image 129
ChrisW Avatar answered Sep 26 '22 15:09

ChrisW


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.

like image 41
Arnis Lapsa Avatar answered Sep 23 '22 15:09

Arnis Lapsa