为什么要在src文件夹中组织项目? [英] Why organize projects inside a src folder?
问题描述
首先,我想表明我知道不需要src
文件夹.实际上,只需为项目手动创建一个目录,创建一个有效的project.json
和一个Startup
类,即使没有Visual Studio,一切也可以正常工作.
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.
我的意思是:当我们使用Visual Studio 2015中的ASP.NET 5创建一个新项目时,它会创建一个解决方案,并且在解决方案的文件夹中会创建一个src
文件夹.在此文件夹中创建了所有项目.
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.
现在为什么有人要在解决方案文件夹中创建一个src
文件夹?为什么不将项目直接放入解决方案文件夹?在项目组织方面是否存在将项目放入src
文件夹的优势?为什么VS现在要这么做?
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?
推荐答案
您的项目中通常有更多与源代码无关的文件,例如:
You usually have more files inside your project that are not source code related like:
- README.md
- CONTRIBUTING.md
- .gitignore
- 许可
- 构建脚本
- 文档和工具文件夹等
还有许多其他文件,具体取决于您的配置.因此,如果您有src文件夹,则无需将源代码文件与这些文件混在一起.
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.
这篇关于为什么要在src文件夹中组织项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!