Updating Project to .net 6
In this lesson, we're going to update the project to .net6
Get the project source code below, and follow along with the lesson material.
Download Project Source CodeTo set up the project on your local machine, please follow the directions provided in the README.md
file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.
This lesson preview is part of the The newline Guide to Fullstack ASP.NET Core and React course and can be unlocked immediately with a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to The newline Guide to Fullstack ASP.NET Core and React with a single-time purchase.

[00:00 - 00:06] When I started working on this project .NET 6 was on its preview version. So I thought of starting it with version 5.
[00:07 - 00:16] But now that version 6 has been released, I'll show you how we can update our project from version 5 to version 6. Let's start by installing the version 6.
[00:17 - 00:33] You can open .NET.Microsoft.com/download and since I'm using Mac, I will install X64 version, you can install a 64 version if you have a MacBook with M1 processor. Since I'm using Intel processor, I will choose this.
[00:34 - 00:43] Please choose the suitable version and install .NET 6. Once we are done installing it, we can look at migrating version 5 to version 6 .
[00:44 - 00:49] We can follow some of these steps which are applicable for us. We will not cover everything mentioned here.
[00:50 - 01:01] Select Visual Studio Code here and we have VS Code. We have C# extension installed and lastly, we have installed .NET 6 SDK.
[01:02 - 01:10] And we can create a global.json file if we want to have different projects that use different versions. And for now, we will not go for this option.
[01:11 - 01:15] And if you look at this, update the target framework. This one is applicable for us.
[01:16 - 01:20] So this is what we are going to do. First of all, we can check the SDK versions we have installed.
[01:21 - 01:38] So let's go back to our project and we can open a terminal and run .NET - info. And I have version 5 and version 6 SDK installed.
[01:39 - 01:46] I hope you are able to see the version 6 here as well. So what we will do is we will start by going to the API inside the project file .
[01:47 - 01:56] We will start by changing the target framework from version 5 to version 6. We will also update the dependencies related to the runtime.
[01:57 - 02:15] And for that, we will change the JWT bearer so I can make it 6.0.4. I will change Microsoft Entity Framework Core Design to same 6.0.4.
[02:16 - 02:25] We don't have to worry about this Swashbuckle ASP net core and the auto mapper. Now we need to do the exact same thing for the other projects.
[02:26 - 02:35] So let's go to Entity Project first. Let's close our client project and open the Entity Project and we will open Entity.csproj.
[02:36 - 02:45] And I will change .NET 5 to .NET 6. And I will change this version to 6.0.4.
[02:46 - 02:53] And we can cancel it for now. And now let's open the infrastructure.csproj file.
[02:54 - 03:08] And let's start by changing the target framework from version 5 to version 6. And we will change Entity Framework Core SQLite to 6.0.4.
[03:09 - 03:13] And everything else can stay the same. And let's close this for now.
[03:14 - 03:40] And now to confirm that everything else is working as expected, I will shut it, go to the root project and run .NET Re-STOM. Now we can go back to our API project once again and run .NET Watch Run.
[03:41 - 03:47] We don't see any errors here. And let's open the browser to confirm this.
[03:48 - 03:54] We can see that our APIs are working as expected. Perfect.
[03:55 - 04:03] Let me try to add this to the cart and this works. So yeah, everything is working as expected.
[04:04 - 04:21] It was pretty straightforward to update the project from version 5 to version 6 because it is backward compatible with version 5. In the next lesson, we'll take a look at the new hosting model we get with .NET 6 and we will implement it in our projects as well so that you can see what the new hosting model is.
[04:22 - 04:29] So I'm talking about the new hosting model here. So let's start implementing it from the next lesson.