How to Upgrade to .NET 6? 🛠️

If you're wondering how to upgrade to the latest version of the .NET framework, you'll learn how in this article with Visual Studio and JetBrains Rider!

4 min read
How to Upgrade to .NET 6? 🛠️
Photo by Spencer Lind from Pexels.

A few weeks ago, I learned that a new version of the .NET platform was officially released in November 2021. We knew we had to update soon to get the new improvements. We also didn't want to fall too far behind, even though we were using .NET 5 and that version is supported until May 2022.

But, since it had been a long time since I had programmed in C#, I didn't know how we could update our projects. Will it be difficult to upgrade? Are there any other implications? 🙈

So what did I do? I searched the Web and found it's easier than you think! At least with the right tools! 😉

I'll document it here for a quick reference if I need to.

Microsoft Visual Studio

💡
To update your .NET project in Visual Studio, you'll need its latest version, 2022. You can download it here if you don't already have it installed.

In my case, I already had the Community Edition.
🌎
You may notice in my screenshots that Visual Studio seems to be installed in French, I'm sorry. But I'm sure that with the attached notes you'll quickly understand.

If you're using Microsoft's official IDE, Visual Studio, the procedure is quite simple. It only has five steps:

  • Open your project solution with Visual Studio 2022.
  • In the top menu of the IDE, click on Project then on Property of YOUR_PROJECT.
Screenshot showing how to open project properties in Visual Studio.
  • Under ApplicationGeneralTarget Framework, select .NET 6.0.
Screenshot showing how to modify the target framework in Visual Studio.
  • Save with Ctrl + S.
  • Launch your app and make sure it's still working properly.

It's simple when you know it, isn't it? 😅

JetBrains Rider

If you are more a JetBrains fan and use their official IDE for .NET applications, Rider, the procedure is also quite simple:

  • Open your project solution with JetBrains Rider.
  • Right-click on your project and select Properties.... You can also use the Alt + Enter shortcut.
Screenshot showing how to open project properties in JetBrains Rider.
  • Under PropertiesApplication, click on the ... button next to the Target framework property.
Screenshot showing how to modify the target framework in JetBrains Rider.
  • In the new modal window named Edit Target framework, click on the net5.0 checkbox to deselect it and click on the net6.0 checkbox to select it.
  • Click on the OK button to close the modal window and to return to the Project Properties window.
Screenshot showing how to upgrade from .NET 5 to .NET 6 in JetBrains Rider.
  • While you're at it, you may have noticed the Language Version property which is currently set to C# 9.0. You can change it to C# 10.0 to make sure you're using the latest version available.
  • Click on the OK button to save your changes and to close the Projet Properties window.
  • Finally, make sure your application still builds and runs as before.

There you go, your application now runs under the .NET 6 framework! 🥳

Manual file editing

If you take a look at the only modified file, the YOUR_PROJECT.csproj file, you may notice that we could also just modify it. 😮

Screenshot showing the differences in the .csproj file after our changes.

It's a lot faster, don't you think? 😂

Conclusion

The next step will also be to update your dependencies. But that will be in another article! 😅


Ressources

Announcing .NET 6 -- The Fastest .NET Yet
.NET 6 is now available. It is easier to use, runs faster, and has many new features.
Migrate from ASP.NET Core 5.0 to 6.0
Learn how to migrate an ASP.NET Core 5.0 project to ASP.NET Core 6.0.