ASP.NET Core 6.0 - Migrate From .NET 5.0

Ken Haggerty
Created 12/31/2021 - Updated 01/12/2022 02:34 GMT

This article describes the new VS 2022 project properties UI and how to upgrade the Target framework and NuGet packages. I will assume you have downloaded the ASP.NET Core 6.0 - Users With Device 2FA Project.

Users With Device 2FA Project and Article Series

This article series is about the implementation of ASP.NET Core 6.0 with Visual Studio 2022. The ASP.NET Core 6.0 - Users With Device 2FA Project (UWD2FAP) implements WebAuthn, also known as FIDO2, instead of authenticator apps for two-factor authentication (2FA). The project implements Bootstrap v5 and Bootstrap Native. After a user registers, they can enable 2FA with Windows Hello, Android Lock Screen, or a FIDO2 security key. If I had this project when I created KenHaggerty. Com three years ago, I would have started with this user authentication template. The latest version is published at Preview. KenHaggerty. Com. I encourage you to register and evaluate multiple 2FA devices in Manage Account > Two-Factor Authentication. Details, screenshots, and related articles can be found at ASP.NET Core 6.0 - Users With Device 2FA Project. The details page includes the version change log.

Updated with links as the articles become published.

Visual Studio 2022 (VS 2022) is required to develop .NET 6 and ASP.NET Core 6.0 applications. VS 2022 Downloads. I have been working with VS 2022 since Preview 3.1. The General Availability version was released on November 08, 2021. To migrate an ASP.NET Core 5.0 application, load and build the application in VS 2022. Mitigate all errors, warnings, and messages. My ASP.NET Core 5.0 applications load, build, and run in VS 2022 without issue. The initial migration from ASP.NET Core 5.0 to ASP.NET Core 6.0 is as simple as updating the Target framework and NuGet packages.

Open the Properties window with a right-click on the project then click Properties.

Right Click Project Properties

Select .NET 6.0 from the Target framework dropdown.

Project Properties Target Framework

Right-click on the project then click Manage NuGet Packages.

Right Click Project Manage NuGet Packages

On the Updates tab, check Select all packages then Update.

NuGet Packages Update

.NET 6.0 implements C# 10.0 which introduces new features. I describe migrating the Startup.cs code to Program.cs in the ASP.NET Core 6.0 - Top-Level Statements article. I describe migrating to global usings and file scoped namespaces in the ASP.NET Core 6.0 - Global Usings article. The new UI includes a Nullable setting on the Build tab which specifies the project-wide C# nullable context. This UI option was introduced in Visual Studio 16.5 and is only enabled for projects that use C# 8.0 or later. Migrating existing code, EF Core models, and data to a project-wide nullable context should be carefully planned. The UWD2FAP has the nullable context enabled and I have mitigated all warnings and issues. I am creating a new article series to describe the nullable context and how to migrate from the data up.

Project Properties Build Nullabe Setting

After setting Nullable to Disabled, a nullable property is added to the project file. Right-click on the project then click Edit Project File.

Right Click Project Edit Project File
Edit Project File Xml

Article Tags:

VS 2022

Comment Count = 0

Please log in to comment.

Login Register
Logged in users receive web notifications.
Web Notifications