Upgrade Your Existing Projects to .NET 8 & ABP 8.0
A new .NET version was released on November 14, 2023 and ABP 8.0 RC.1 shipped based on .NET 8.0 just after Microsoft's .NET 8.0 release. Therefore, it's a good time to see what we need to do to upgrade our existing projects to .NET 8.0.
Despite all the related dependency upgrades and changes made on the ABP Framework and ABP Commercial sides, we still need to make some changes. Let's see the required actions that need to be taken in the following sections.
Installing the .NET 8.0 SDK
To get started with ASP.NET Core in .NET 8.0, you need to install the .NET 8 SDK. You can install it at https://dotnet.microsoft.com/en-us/download/dotnet/8.0.
After installing the SDK & Runtime, you can upgrade your existing ASP.NET Core application to .NET 8.0.
Updating the Target Framework
First, you need to update all your *.csproj
files to support .NET 8. Find and replace all your TargetFramework
definitions in the *.csproj
files to support .NET 8.0:
<TargetFramework>net8.0</TargetFramework>
This and all other changes mentioned in this article have already been done in the ABP Framework and ABP Commercial side, so you would not get any problems related to that.
Updating Microsoft Package Versions
You are probably using some Microsoft packages in your solution, so you need to update them to the latest .NET 8.0 version. Therefore, update all Microsoft.AspNetCore.*
and Microsoft.Extensions.*
packages' references to 8.0.0
.
Checking the Breaking Changes in .NET 8.0
As I have mentioned earlier in this article, on the ABP Framework & ABP Commercial sides all the related code changes have been made, so you would not get any error related to breaking changes introduced with .NET 8.0. However, you still need to check the Breaking Changes in .NET 8.0 documentation, because the breaking changes listed in this documentation still might affect you. Therefore, read them accordingly and make the related changes in your application, if needed.
Update Your Global Dotnet CLI Tools (optional)
You can update the global dotnet tools to the latest version by running the dotnet tool update
command. For example, if you are using EF Core, you can update your dotnet-ef
CLI tool with the following command:
dotnet tool update dotnet-ef --global
Installing/Restoring the Workloads (required for Blazor WASM & MAUI apps)
The dotnet workload restore
command installs the workloads needed for a project or a solution. This command analyzes a project or solution to determine which workloads are needed and if you have a .NET MAUI or Blazor-WASM project, you can update your workloads by running the following command in a terminal:
dotnet workload restore
Docker Image Updates
If you are using Docker to automate the deployment of applications, you also need to update your images.
For example, you can update the ASP.NET Core image as follows:
- FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base
+ FROM mcr.microsoft.com/dotnet/aspnet:9.0
You can check the related images from Docker Hub and update them accordingly:
- https://hub.docker.com/_/microsoft-dotnet-aspnet/
- https://hub.docker.com/_/microsoft-dotnet-sdk/
- https://hub.docker.com/_/microsoft-dotnet-runtime/
Upgrading Your Existing Projects to ABP 8.0
Updating your application to ABP 8.0 is pretty straight-forward. You first need to upgrade the ABP CLI to version 8.0.0
using a command line terminal:
dotnet tool update Volo.Abp.Cli -g --version 8.0.0
or install it if you haven't before:
dotnet tool install Volo.Abp.Cli -g --version 8.0.0
Then, you can use the abp update
command to update all the ABP related NuGet and NPM packages in your solution:
abp update --version 8.0.0
Also, if you are using ABP Commercial, you can update the ABP Suite version with the following command:
abp suite update --version 8.0.0
After that, you need to check the migration guide documents, listed below:
Check these documents carefully and make the related changes in your solution to prevent errors.
Final Words
That's it! These were all the related steps that need to be taken to upgrade your application to .NET 8 and ABP 8.0. Now, you can enjoy the .NET 8 & ABP 8.0 and benefit from the performance improvements and new features.
Happy Coding 🤗
Comments
Cris Porper 53 weeks ago
cool
Lee Richardson 52 weeks ago
Are there any changes required to take advantage of the new rendering modes offered in Blazor 8? In particular I'd like to specify rending modes on a component-by-component basis and take advantage of the new SSR (server-side-rendering) modes.
Engincan Veske 51 weeks ago
It's on the road-map for the upcoming version. See #18289
Bekzod Allaev 51 weeks ago
Hey, Engincan and community. After migration to NET 8.0 and to ABP 8.0.0 RC-3 I have two errors when I launch my Blazor application:
Engincan Veske 51 weeks ago
It seems you need to run the
abp bundle
command in the blazor directory. Can you run the command and re-try to run the application and check if it works?Also, you may consider updating the
wasm-tools
workload, I don't expect it's related to that but it's better to update it.Bekzod Allaev 51 weeks ago
Hey Engincan, Thanks a lot for advice, running
abp bundle
command inside blazor directory solved the issueshengjie 49 weeks ago
Actually, there is no image for
aspnet:8.0-bullseye-slim
. The docker image for asp.net core 8.0 ismcr.microsoft.com/dotnet/aspnet:8.0
Engincan Veske 49 weeks ago
Thanks for the correction. I was using
aspnet:7.0-bulseye-slim
in one of my applications and while writing this article, I thought they would also addaspnet:8.0-bulseye-slim
image, but apparently they did not. I will update the article 👍omerkaya 33 weeks ago
I got the same error as Bekzod mentioned and "abp bundle" command solved the problem. Thanks
yaser yousry 31 weeks ago
Nice Post and helpful, But i want to know can i upgrade to .NET8 without upgrading abp (version 5.3.0) ?? i am getting this error "Volo.Abp.ObjectMapping.DefaultObjectMapper -> Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider -> λ:Volo.Abp.AutoMapper.IMapperAccessor -> λ:Volo.Abp.AutoMapper.MapperAccessor"