In this post, we will learn about to ASP.NET Core and then I explain the project structure of an ASP.NET Core web application. If you are new to .NET Core, you can read my Introduction to .NET Core post first.
Also will Learn what changes have been made in ASP.NET Core from the project structure point of view and we will slightly discuss the execution pattern of ASP.NET Core application in this article
ASP.NET Core Project Structure
The following is a default project structure when you Create an ASP.NET Core application in Visual Studio 2019.
The above solution explorer displays project solution. We can change it to folder view by clicking Solution and Folders icon and selecting Folder View option.
(1) Connected Services :
This is the first node in your project’s structure and possibly the less-used one. It is intended to automate the multiple steps necessary to connect a project to an external service (like Azure Storage or Application Insights). Usually, it just adds necessary packages and gives you basic instructions on how to start using the service in your app.
This element of your project structure contains all packets or other projects on which your project depends.
There are two main folders inside this node.
1) Analyzers :
Analyzers help you make your code better, cleaner, error-free. Each analyzer checks that your code satisfies a list of rules incorporated in it. If any part of your code does not apply to one of the rules, you will see either a Warning or an Error while you build your project. analyzers work only at compile time and do not affect your resulting application.
2) Frameworks :
This folder contains a list of frameworks your project depends on. This information is important if you publish your web app as a runtime-dependent (as opposed to a self-contained one). In this case, all the frameworks listed here must be installed on the server where you will run your app.
(2) Properties :
This part contains different properties of your project that you can modify by double-clicking on this node in the Solution Explorer. Most of the properties there affect the compile- and debug-time behavior of your project.
The only item inside this node is a “launchSettings.json” file that contains the list of the launch profiles. Each profile defines how to run your project when you click on the “Run” button in Visual Studio. The following is a default launchSettings.json file
(3) wwwroot :
(4) Pages :
This folder contains all pages (forms) of your web applications. ASP.NET Core has two default approaches for content rendering: MVC (Model View Controller) and Razor Pages (which is, actually, a kind of MVC, where each controller and the corresponding view are stored together). Both approaches use Razor syntax that you can think of as HTML + C#.
(5) Program.cs :
This file defines the “Program” class with one static method which is the entry point of your web application.The only purpose of this method is to define the host and then pass the control to the Startup class.
This class contains a lot of code from the very beginning and will become even bigger when you start adding new features to your application. The “Startup.cs” class serves three main purposes:
- It performs all initialization tasks (setting application-wide constants, DB seeding, migrations, etc.).
- It defines the middleware pipeline of your web-application.
- It registers all services used in this project in the dependency injection container.
In this tutorial, we have learned a few things about the ASP.NET Core Solution Structure or Project structure. The Visual Studio Team has made lots of improvements over the older system.
we will learn more about wwwroot folder in Asp.Net core in our next tutorial
SEE MORE ARTICLE
- Auto Refresh Partial View in ASP.NET MVC
- Difference between .NET Core and .NET Framework
- What is ASP.NET Core
- Difference between TempData keep() And Peek() in Asp.Net MVC
- Difference between viewbag,viewdata and tempdata in asp.net mvc
- ASP.NET MVC With AngularJS
- Retrieving Data Using Form Collection and Inserting Into ASP.Net MVC
- MVC CRUD Operations Using Entity Framework
- Search Functionality in ASP.NET MVC
- How to create a User Registration page using asp.net mvc
- Store Multiple Checkbox state from cookie using Jquery
- Cascading Dropdownlist using Ajax in Asp.Net Mvc with city state country
- Insert, Update, Delete In GridView Using ASP.Net C#
- Binding Dropdownlist With Database In Asp.Net MVC
- Search and Filter data in Gridview using Asp.net MVC
- Select Insert, Update And Delete With ASP.NET MVC
- Display Data in GridView Using Asp.net MVC
- Validation in ASP.NET MVC Razor view
- CRUD Operation Using 3-Tier Architecture In ASP.NET
- How to get Connection String from Web.Config in Asp.Net C#
- Login page using 3-Tier Architecture in ASP.Net
- Asp.Net Image Upload in 3-Tier Architecture and store in sql database