1. ASP.NET MVC Folder Structure
Before, deep diving into ASP.NET MVC 5, there are certain guidelines that you must follow in order to write MVC code properly and structured. MVC Folder Structure guides you to choose a suitable folder to store different types of files.Solution Explorer
MVC Folder Structure
App_Data – This folder contains data files like
xml files etc.
App_Start – It contains class files which gets executed when application starts. Normally it is config files like
Content – It contains static files like
images and icon files.
Controllers – It contains class files which handle user's request and response. All the controller file name ends with Controller word like
Models – It contains model class files which handles database task.
Scripts – It contains scripts file like
Views – It contains HTML files. There may be separate folder for each controller. For
HomeController.cs; there is Home folder inside View folder.
Shared - It is under view folder and it contains shared files like
master page layout etc. Shared folder content can be accessed by any controller.
Some Important Files
Global.json – This file is used for add dependencies or add external projects reference into your current project. It specifies the path where system should search for dependency folder.
Project.json – Project.json file in asp.net core is used to define project metadata, compilation information and dependencies.
Global.asax – It allows you to write code at application level events such as
Package.config – It is managed by NuGet to keep track of what packages and versions you have installed in the application.
Web.config – It contains application level configuration.
This chapter only introduces the folder structure of ASP.NET MVC5. Once you know the behavior and properties of the folder, it is easy to find, store and organize project related files. In the next chapter, you will Understand Controller in MVC5.