Part - 1 Creating ASP - NET Core Web Application
Part - 1 Creating ASP - NET Core Web Application
Once you click on the Create a new project box, it will open the “Create a new project” window. This
window includes different .NET 6 application templates. Here we will create a simple Web application
from scratch, so select the ASP.NET Core Empty project template and then click on the Next button
as shown in the below image.
Once you click on the Next button, it will open the following Configure Your New Project window.
Here, you need to provide the necessary information to create a new project. First, give an appropriate
name for your project (FirstCoreWebApplication), set the location where you want to create this
project, and the solution name for the ASP.NET Core Web application. And finally, click on
the Create button as shown in the image below.
Once you click on the Create button, it will create a new ASP.NET Core Web Application in Visual Studio
2022 using .NET 6. Wait for some time till Visual Studio restores the packages in the project. The
restoring process means Visual Studio will automatically add, update or delete configured
dependencies as NuGet Packages in the project. The project will be created with the following file and
folder structure in Visual Studio 2022. The major change that you can see here is, we don’t have the
Startup class anymore which we found in the earlier version of ASP.NET Core Framework.
Here, the output “Hello World!” comes from the Main method of the Program class which is present
inside the Program.cs file as shown in the below image.
Now, open the Program.cs class file and then change the “Hello World!” string to something else as
shown in the below code and rerun the application and it will change the output accordingly.
namespace FirstCoreWebApplication
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.Run();
}
}
}
Note: In our coming sessions, we will discuss how and when to use some of the above project templates
in detail.