In this articles, I will try to explain the structure of Asp.Net MVC project. When we create a new project than there are lots of folders and files are available. So, what is the purpose of these folders and files. Why we use Model, Controller, View, Areas, App_Data etc folder. What type of files manage inside it.
MVC Project Structure
When we create an Asp.Net MVC project using Visual Studio using template then it provides common structure of folders and files. Actually Folders creates categorization of the files for better understandability. So, following are the details about the these folders.
/bin
It contains compiled assemblies [.dll,.pdb] as well as referenced assemblies which are not in GAC.
Note: sometimes you are not able to see “bin” and “obj” folder, because visual studio hides it. To see these folders, you need to click on “show all files”.
/Content
It contains static files like images, css files, jquery/javascript files. It also contains theme for the application.
/Models
It contains domain model classes, view model.
/Scripts
When you create Asp.Net MVC project in visual studio 2010, we will find a folder named with “Scripts”. It contains the script files like jquery, javascript, Microsoft ajax helper etc in it.
/Controllers
It contains controller classes for Asp.Net MVC application. Controller classes name should be always prefix with controller word.
/Views
It contains view or partial view files which are specified for the controller.
/Views/Shared
It contains shared view files and layout files which are not specified with any controller and it can be shared by any controllers.
/Areas
It contains the module project of Asp.Net MVC project. Areas are a way of partitioning the large application into smaller pieces. Basically Areas are used when you want to create different modules in your project. It also contains controller, model folder inside it.
Special Folders
There are some special folders that are not related to MVC application but as you know MVC is a type of Asp.Net applications. So, you can put this folder inside the MVC application.
/App_Data
App_Data folder is a special place where we can put private data such as data access classes, xml files, file based database [.mdf]
/App_GlobalResources
It contains resource files such as .resx and .resources files that are compiled into the assemblies with global scope.
/App_LocalResources
It contains resource files such as .resx and .resources files that are associated with specific page or user control.
/App_Browsers
It contains Browser definitions such as .browser files that ASP.NET uses to identify individual browsers and determine their capabilities.
Conclusion:
So, Today we learned the asp.net mvc project structure, what is the use of folder like model, controller, view and which type of files contain it.
I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and If you like this post, please share it with your friends. Thanks