Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why organize projects inside a src folder?

First of all, I would like to make it clear that I know that the src folder is not required. Indeed, one can simply create manually one directory for the project, make one valid project.json and one Startup class and everything should work fine even without Visual Studio.

My point is the following: when we create a new project using ASP.NET 5 from Visual Studio 2015 it creates a solution and inside the solution's folder it creates one src folder. Within this folder all projects are created.

Now why would anyone want to make one src folder inside the solution folder? Why not putting the projects direct onto the solution folder? Is there any advange on the organization of the project to put the projects inside a src folder? Why VS does that now?

like image 415
user1620696 Avatar asked Mar 14 '15 19:03

user1620696


People also ask

What is the point of a src folder?

The src stands for source. The /src folder comprises of the raw non-minified code. The /src folder is used to store the file with the primary purpose of reading (and/or editing) the code. The /src folder contains all the sources, i.e. the code which is required to be manipulated before it can be used.

What should be inside src folder?

The src directory contains all of the source material for building the project, its site and so on. It contains a subdirectory for each type: main for the main build artifact, test for the unit test code and resources, site and so on.

What is src folder in Java project?

Describes the Java™ source tree. When you create an API project, it is set up as a Java project with separate folders for source and class files. The source folder is named src .

Should I put project and solution same folder?

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.


2 Answers

You usually have more files inside your project that are not source code related like:

  • README.md
  • CONTRIBUTING.md
  • .gitignore
  • LICENSE
  • Build scripts
  • Docs and tools folders, etc.

And a tons of others files that depend on your configuration. So, if you have a src folder, you don't need to mix your source code files with those.

like image 159
fcartu Avatar answered Oct 10 '22 12:10

fcartu


because you may have your code in src folder (class libraries, etc), test in your test folder, documentation in a documetation folder

in global.json you specify which folders does roslyn pick for compiling.

like image 3
Bart Calixto Avatar answered Oct 10 '22 11:10

Bart Calixto