Can't install MAUI workload properly on Mac with .NET SDK 8

Paweł Baturo 0 Reputation points
2024-09-01T10:44:10.3333333+00:00

I’m having trouble installing the .NET MAUI workload on my Mac running macOS. Despite trying different versions of the .NET SDK (8.0.401 and 8.0.400), Visual Studio Code consistently fails to detect the installation.

 

I was removing all .net installations also using recommended tools from documentation, and installing .net SDK again from scratch. Nothing changed the situation.  I have been using  "dotnet workload repair" , "dotnet workload clean", "dotnet workload restore",  "dotnet workload update", nothing seems to work.

 

Here are the sample logs always ending with same error

Writing workload pack installation record for Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64 version 7.0.20... Warning: Workload garbage collection failed with error: Workload version 8.0.400-baseline.24375.2 was not found.. 

 

When I have SDK 8.0.401 installed, I have had similar error.

 

I suspect that a previous installation of Visual Studio 2022 (which included .NET 5 and .NET 6) might have left behind some configuration or components that are interfering with the current setup.

 

Here are the steps

  1. sudo dotnet workload install maui
  2. dotnet workload list

Result: No entries on the list. However when I run

"sudo dotnet workload list"

 

I see: 

Installed Workload Id Manifest Version Installation Source


maui 8.0.72/8.0.100 SDK 8.0.400

 

On VSCode I have the error on.net maui project (created from template)

".NET MAUI SDK: not found. Please check the .NET MAUI output window for more info."

The output looks:

 

.NET MAUI Workloads:

Path: /usr/local/share/dotnet Version: 8.0.400

Suggested Workloads to be installed:

Workload: maui-ios

Workload: maui-android

.NET MAUI SDK verification failed. Please try running dotnet workload restore from your project's directory and reopen the solution.

 

I also get an error from C# dev kit: "Failed to restore solution."

The output looks:

 

Determining projects to restore...

/usr/local/share/dotnet/sdk/8.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android [/Users/pbaturo/Repos/dotnet-learning/MauiFirstApplication/MauiFirstApplication/MauiFirstApplication.csproj::TargetFramework=net8.0-android]

/usr/local/share/dotnet/sdk/8.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/Users/pbaturo/Repos/dotnet-learning/MauiFirstApplication/MauiFirstApplication/MauiFirstApplication.csproj::TargetFramework=net8.0-android]

 

I have completely no idea why I have this issue. 

 

Can anyone help me with overcoming this, please?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,798 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,409 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
334 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 30,666 Reputation points Microsoft Vendor
    2024-09-02T08:33:56.2333333+00:00

    Hello,

    Suggested Workloads to be installed: Workload: maui-ios Workload: maui-android

    From the error message, the workloads are missing.

    On macOS, you could run the following command in a terminal to install the maui-android and maui-ios workloads:

     sudo dotnet workload install maui-android maui-ios
    

    For more details about installation, please see

    Install Visual Studio 2022 and Visual Studio Code to develop cross-platform apps using .NET MAUI - .NET MAUI | Microsoft Learn

    Update


    Workload garbage collection failed with error: Workload version 8.0.400-baseline.24375.2 was not found

    It's a known issue and it was fixed with SDK 8.0.402, please see [NETSDKE2E]With 8.0.400 SDK zip installed, Warning: "Workload garbage collection failed with error: Workload version 8.0.400-baseline.24372.6 was not found.." happens when installing maui workload. · Issue #42358 · dotnet/sdk · GitHub

    About how to upgrade to a new .NET version, please see Upgrade to a new .NET version - .NET | Microsoft Learn

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Bruce (SqlWork.com) 64,161 Reputation points
    2024-09-03T20:49:34.4133333+00:00

    you might want to try workload repair and clean first:

    https://video2.skills-academy.com/en-us/dotnet/core/tools/dotnet-workload-repair

    once cleaned/repair, try update. should be no errors.

    on my Mac, once workloads were messed up (thanks aspire), I finally just deleted all the installed manifests:

    %ls /usr/local/share/dotnet/sdk-manifests/

    and reinstalled.

    location of some other folders you might want to clean:

    Dev tools : ~/Library/Developer
    Android: ~/Library/Developer/Xamarin/android-sdk-macosx
    Java: /Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home
    Dotnet: /usr/local/share/dotnet


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.