.NET 7.0 to 8.0 upgrade notes
Some notes here for my future self and anyone else who might find them useful.
With Jetbrains Rider now offering basic support for .NET 8.0 (which was released by Microsoft on Nov 14th 2023) I thought it was time to take a look at upgrading a large .NET 7.0 project to .NET 8.0
I'm a sucker for the latest and greatest and I'm always keen to keep my projects up to date with the latest versions of the frameworks and libraries I use. I'm also keen to keep my skills up to date and I'm always looking for opportunities to learn new things.
The Microsoft documentation on upgrading from .NET 7.0 to 8.0 looked pretty straightforward so I thought I'd give it a go on new branch.
Overview
The upgrade from .NET 7 to .NET 8.0 was fairly painless and for me :-
- Required editing .csproj files and re-targeting the TargetFramework
from
<TargetFramework>net7.0</TargetFramework>
to
<TargetFramework>net8.0</TargetFramework>
- Looking through and updating the following nuget packages to 8.0.0.
- Microsoft.AspNetCore.*
- Microsoft.EntityFrameworkCore.*
- Npgsql.EntityFrameworkCore.* (Postgres related packages)
- Microsoft.Extensions.* (e.g. .Options, .Configuration.Json etc.)
I use Rider as my .NET IDE which has a very user friendly nuget management UI for doing this Rider NuGet window
Some Issues
The upgrade was fairly painless and the solution with 20+ projects compiled and ran without any issues.
I did encounter a couple of issues along the way which I've documented below.
Docker Port 8080
I am using Docker Containers that run on Azure Container Registry As part of the upgrade I changed the Docker Compose file to use the latest version of the .NET 8.0 images.
However I noticed my containers were failing to start and timed out.
On further investigation I found that the .NET 8.0 now runs on port 8080 by default, previously in .NET 7.0 it ran on port 80.
Good article here documenting this change.
A quick change to my scripts to use port 8080 and a re-deployment to my Azure Development Environments and everything was working again 👍
Azure AD B2C Auth Error - IDW10403: Token is not a JWT token
I have created a separate article on an auth issue that arose after upgrading from Azure AD B2C see here IDW10403: Token is not a JWT token