Before Going to ASP.NET MVC Folder Structure
In the Previous Lecture , we created a new ASP.NET MVC 5 application. We learned different steps which need to be followed when creating MVC 5 Web application. We saw every step in detail that how to create ASP.NET MVC application. After creating the application successfully, we build the application and run it in the browser. There we also saw that VS created a file hierarchy which we are going to discuss as ASP.NET MVC Folder Structure.
What is ASP.NET MVC Folder Structure:
In the above figure, you can see that there are a lot of folders and files that VS created for ASP.NET MVC Application. We will look at all one by one.
- Properties: It contains AssemblyInfo.cs file which contains all information about your project. Information about GUID, project name, copyright, trademark etc.
- References: Next one is references. It contains all libraries references which are being used by this project. References about ‘System’ libraries, ‘Microsoft’, ‘XML’, ‘JSON’, ‘LINQ’.
This folder is empty when a project is created. As you start creating the database then its related files are stored in this folder. Data Files like LocalDB, .mdf files.
This folder contains configuration files which are necessary for a project to be compiled and run. There are three .cs files in this folder. BundleConfig.cs, FilterConfig.cs and RouteConfig.cs. The most important one and of our concern is RouteConfig.cs. It contains default routing path of ASP.NET MVC application. As we are creating MVC based application so, the controller is always in control. You can see in the image that default controller is ‘Home’, the default action (method or function) is ‘index’ and id is optional (means only use in get, update, delete queries). You can change this routing scheme.
Content folder contains bootstrap, css, images and other resource files. MVC automatically add bootstrap.css, bootstrap.min.css and site.css for the responsive behavior of the site.
This folder contains all controllers which are using in the project. By default HomeController.cs (controller attribute in RouteConfig.cs is pointing towards this controller) is added which shows us homepage of ASP.NET in the browser.
This folder is almost of no use in many cases. It has different formats of glyphicon files. You can add custom glyphicons as you desire.
All models reside in this folder. Right now it is empty but when you start building your backend logic, models must be added in here.
It contains jquery files which add more responsiveness to your pages.
This folder contains .cshtml files. If you are doing frontend development then you are more interested in this part of ASP.NET MVC folder structure. Every controller creates its own view folder. ‘Shared’ folder contains common layouts which can be invoked from any view.
This file has code that runs at the application level. Like Application_Start, route, bundle and other configurations.
This configuration file is managed by NuGet. It gives you detail about installed packages. Whenever you install a new package it appears in this file.
It contains application level configuation details like package configurations, validations, publicKeyToken, id etc.
Other Topics and Categories
- Windows Presentation Foundation Introduction
- WPF Vs Windows Forms
- WPF Hello World Application
- ASP.NET MVC Introduction
- ASP.NET MVC Architecture
- ASP.NET MVC Application
- C# Tutorials
- OOP Concepts