Amazon recently announced that they had support for .NET 6 in their Lambda product, which was all that was holding me back from migrating forward from .NET Core 3.1.
The process was fairly simple – there are a few breaking changes in .NET 6 but nowhere near as many as there were moving from .NET core 2 to .NET core 3.
Development environment
I primarily use Debian Bullseye as my development environment (there must be dozens of us!). I do switch back to Windows 11 occasionally but Debian is far more productive if, like me, you’re using Docker containers built using Linux to deploy things like web services. As I’m on Debian, I’ve ditched Visual Studio altogether and moved to Visual Studio Code for everything.
Install .NET 6
Microsoft supply a shell script for installing .NET as an alternative to using a package. I find the shell script much better, even though it’s intended for CI/CD environments. installing .NET 6 is as simple as downloading the script, adding execute permission to it and running it:
drubie@chungus:~/Downloads$ ./dotnet-install.sh
By default it will install the latest version of .NET in a hidden directory in your account called .dotnet. You can simply add this directory to your path and you are good to go. The script has a version argument if you want earlier versions of the dotnet system.
Project file changes
In Visual Studio Code, change the “TargetFramework” to “net6.0” in all the .csproj files
Then you need to update the references in your projects. I had a few conflicts here and there that were fixed by removing all the code generators for Visual Studio that were a hangover from starting the project on Windows. I used the “Nuget Package Manager Gui” in Visual Studio Code to do that.
Fix the database connection issues if you have them
In my case, the MySQL database connection