1 / 4
2 / 4
3 / 4
4 / 4

Saturday 20 June 2020

ASP.Net Core Project Folders and Files Structure

After the creation of any Asp .Net Core project in every situation, we find some pre-defined files and folders are automatically generated. It is really important to have basic knowledge about those files and folder is important before working on an asp .net core project. So in this article, we are going to discuss the infrastructure of our project. Let's get started.



In the above picture, you can clearly see the Solution name "AspCoreUsingVS2019", in the braces, it is written (1 of 1 project ). It indicates that my solution has one project. In the bold font we see the same name as the Solution name i.e. "AspCoreUsingVS2019", but it is the project name(we can give a different name to our solution while creating the project, later we can add multiple projects in the solution also).
 Inside the project, we see a list of files and folders i.e. Connected Services, Dependencies, Properties, wwwroot, Controllers, Models, Views, appsettings.json, Program.cs, Startup.cs.


Connected Services

The third-party configurations like WCF, Web API, and Azure cloud are connected with our project through this.


Dependencies

Here we can configure the packages and references that we need for our project.
To add references, Right-click on Dependencies->Add References
To add packages from NuGet Package Manager, Right-click on Dependencies->Manage NuGet Packages... -> search for your desired Package -> Install 


Properties

By expanding it we can see the launchSettings.json file, which has all project settings like URL, Environment, profile, etc...
Version, copyright, Culture, etc settings can be done here in the Properties.


wwwroot

All the static and dynamic project resources folder/files like CSS, HTML, Images, and Scripts are stored in the wwwroot folder.


Controllers

The Controllers folder contains all the controller classes. The controller class contains public methods (Action Methods) that we can access through the browser.


Models

The Models folder contains all the model classes that are responsible for data logic.


Views

The Views folder contains the User Interface i.e. Views, Partial Views, and Layouts.


appsettings.json

It contains all application configuration settings like web.config.Here we can set connection strings, logging appsettings, etc.


Program.cs

It is the entry point of the application. It contains configuration for Environment variables(Development, Staging/Testing, Production).


Startup.cs

This is the same as Global.asax in Asp .Net framework. It contains the configurations that should execute before the application starts. The configurations like Authentication, Cookies, Caching, Routing, Bundling, etc. As it should load first before application so in the Program.cs in the main method we call the startup class.

No comments:

Post a Comment

If you have any doubts please let me know