I am new to .NET and I have been receiving this error:
"The current .NET MAUI package version ‘9.0.21’ requires the .NET MAUI workload version to be at least ‘9.0.0’. The current .NET MAUI workload version is ‘8.0.83’."
I tried the things ChatGPT told me, I have also checked the dotnet version and it is "9.0.101". But the issue still persists and the app won’t deploy.
Here’s what I have tried:
- Update the .NET MAUI Workload
Run the following commands in your terminal or Developer Command Prompt for Visual Studio:
dotnet workload update
- Check Your .NET SDK Version
Ensure you are using a compatible .NET SDK version for .NET MAUI. For .NET MAUI 9.x, you need .NET 8 SDK.
dotnet –version
If it’s not .NET 8 (e.g., 8.0.x), download and install the latest .NET 8 SDK from the official .NET website.
- Update Visual Studio
Ensure your Visual Studio is up-to-date:
Open Visual Studio.
- Go to Help → Check for Updates.
- Install the latest updates to ensure the correct workloads are supported.
- Clear and Restore NuGet Packages
Sometimes stale packages can cause issues:
- Delete the bin and obj folders in your project.
Restore packages:
dotnet restore
- Verify Workload Installation
Check that the correct version of the .NET MAUI workload is installed:
dotnet workload list
Look for something like:
Copy code
maui-windows 9.0.x
maui-android 9.0.x
maui-ios 9.0.x
If the version is incorrect or missing, reinstall the workload:
dotnet workload install maui
2
Answers
The solution for me was to first run:
I then verified that I had the correct version of the MAUI workload by running:
The list showed that I had version 9.0
BUT, when I then tried to update the nuget packages (from maui version 8 to 9.0.27) i got the exact same error.
My solution then was to manually edit the project files and update the versions on the packages that I wanted to update, and then rebuild the project.
Possible cause: Using .net 8 (LTS) with maui 9.
I was getting the mismatch error, 8.0.83
Even after updating the maui workload + and updating to the latest version of VS 2022.
I didn’t realize that maui9 required .net 9, and I have my target Frameworks still set to .net 8.
updating it to
Caused the build to work.