Back to: ASP.NET Core Tutorials For Beginners and Professionals
Project Templates in ASP.NET Core Application
In this article, I will discuss Project Templates in ASP.NET Core Applications. Please read our previous article discussing How to Create, Build, and Run ASP.NET Core Applications using ASP.NET Core CLI Commands.
Project Templates in ASP.NET Core Application
ASP.NET Core offers several project templates to help you get started with different types of web applications and services. These templates are designed to provide a basic structure and include necessary dependencies and configurations. They include a set of files and configurations that are designed to help you get started quickly with a specific type of application. These templates provide a starting point for your projects, making setting up the structure and dependencies you need easier.
Using ASP.NET Core, we can create different types of Web Applications. As you can see in the image below, while creating an ASP.NET Core Web Application, we have different types of project templates for creating ASP.NET Core Web applications.
So, let us discuss all these project templates a little. We will use these project templates in our upcoming articles to build the ASP.NET Core Web application.
ASP.NET Core Empty Project Template:
As the name says, the ASP.NET Core Empty Project Template has no content by default. If you want to do everything manually from scratch, then you need to select the Empty Project Template. The following image shows the structure of an Empty template.
As you can see, the above project template contains the only basic files required for any ASP.NET Core Web Applications. In this case, we need to add everything manually. To learn the basic concepts of ASP.NET Core, we need to use ASP.NET Core Empty Project Template. In fact, as of now, we have used this ASP.NET Core Empty Project Template to understand the basic concepts.
ASP.NET Core Web App Project Template
This project template creates an ASP.NET Core Web Application using ASP.NET Core Razor Page Content. The Web Application Template uses the new Razor Pages Framework for building web applications. We need to use this project template when we want to develop a web application but do not want the full complexity of ASP.NET MVC. The following image shows the structure of the ASP.NET Core Web App Project Template.
ASP.NET Core Web App (Model-View-Controller) Project Template
The ASP.NET Core Web App (Model-View-Controller) Project Template contains everything that is required to create an ASP.NET Core MVC Web Application. The ASP.NET Core Web App (Model-View-Controller) Project Template creates folders for Models, Views, and Controllers. It also adds web-specific things such as JavaScript, CSS files, Layout files, etc., which are necessary and required to develop a web application. The following image shows the default file and folder structure of the ASP.NET Core Web App (Model-View-Controller) Project Template.
ASP.NET Core Web API Project Template
The ASP.NET Core Web API Project Template contains everything required to create an ASP.NET Core RESTful HTTP service. The following image shows the default structure of the ASP.NET Core Web API Project Template. As you can see from the below image, it contains only the Controllers folder. The website-specific things such as CSS files, JavaScript files, view files, layout files, etc., are absent. This is because an API has no user interface; hence, it does not include such website-specific files. This API template also does not have the Models and Views folder, as they are not required for an API.
You can also create the following Applications using ASP.NET Core.
- Angular, React, or React with Redux: These templates are set up to integrate with the respective JavaScript frameworks/libraries. They include a basic setup that combines ASP.NET Core with Angular or React for building rich client-side interfaces.
- Blazor Server: Used for creating interactive Web UIs using C# instead of JavaScript. It runs on the server and communicates with the client side using SignalR.
- Blazor WebAssembly: This is similar to Blazor Server, but in this case, the application runs entirely on the client side in the browser using WebAssembly.
- Worker Service: This template creates background services and long-running processes without a UI.
- Console App: This is for creating a console application using .NET Core.
- Class Library: This is used to create a reusable set of classes, interfaces, and other functionalities that can be referenced from other applications.
- Minimal Web API: Introduced in .NET 6, this template allows you to create a minimalistic Web API project with fewer files and dependencies.
In the next article, I will discuss Introduction to ASP.NET Core MVC Framework. In this article, I explain Project Templates in ASP.NET Core Applications. I hope you enjoy this article.