user24937004
user24937004

Reputation: 53

How to resolve NET MAUI workload version mismatch?

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: "1. Update the .NET MAUI Workload Run the following commands in your terminal or Developer Command Prompt for Visual Studio:

dotnet workload update

  1. 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.

  1. Update Visual Studio Ensure your Visual Studio is up-to-date:

Open Visual Studio.

  1. Clear and Restore NuGet Packages Sometimes stale packages can cause issues:

Restore packages:

dotnet restore

  1. 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"

Upvotes: 5

Views: 2158

Answers (2)

Tom
Tom

Reputation: 6729

Possible cause: Using .net 8 (LTS) with maui 9.

I was getting the mismatch error, 8.0.83

"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'."

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 had my target Framework still set to .net 8.

<TargetFrameworks>net8.0-android</TargetFrameworks>

updating it to

<TargetFrameworks>net9.0-android</TargetFrameworks>

Caused the build to work.

Upvotes: 4

Fredrik
Fredrik

Reputation: 319

The solution for me was to first run:

dotnet workload install maui

I then verified that I had the correct version of the MAUI workload by running:

dotnet workload list

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.

Upvotes: 2

Related Questions