.NET 6 new features using ASP.NET Core

Download our ASP.NET Core 6 application we try out four new features of .NET 6.

.NET 6 new features

Using Visual Studio 2022 preview, you can see how the following features work in .NET 6:

Console template

Reducing boiler template code by removing the namespace, class and Main method declaration in Program.cs.

Merger of Program and the Startup class

With ASP.NET Core 6, the Startup class can be removed and added into the Program.cs file.

Minimal APIs

One of the biggest ASP.NET Core 6 changes is Minimal APIs, allowing for simple endpoints to sit in the Program.cs file with only a few lines of code.

DateOnly and TimeOnly structs

If you only need a date or a time instance, you can now create these instances without using the DateTime struct.

Software

This is the software that will need to be installed onto your machine.

  • Visual Studio 2022 Preview 3 or above. It will work with the free community version.
  • .NET 6.0 SDK Preview 7 or above. Visual Studio 2022 should already have the .NET SDK installed.

Get the application working

These are the steps to get the application working.

  • Fill out the code example form. We will send you an email where you can download the code example.

You are now ready to go.

Open the project in Visual Studio

Open up RoundTheCode.DotNet6.sln in Visual Studio 2022.

Start the project in Visual Studio.

Hit https://localhost:6002, and you can test out the new .NET 6 features.

More information

Watch our video where we go ahead and implement these four new features in a ASP.NET Core 6 app.