Nuget Errors on restoring packages for Maui project on M1 Mac (trying to restore wrong arch libs)

Jin 1 Reputation point
2022-05-24T13:38:49.347+00:00

I think I somehow messed up my Macbook Air M1 while removing old dotnet versions. With everything installed on release version or even the last RC I can restore and build any other template types such as web but when I do: dotnet new maui -n “MauiProj” and do a “dotnet restore” in that directory I get a bunch of nuget errors like below. Its like nuget is only looking for linux versions. Anyone have any ideas?

/Users/user/temp/MauiProj/MauiProj.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Host.linux-arm with version (= 6.0.5) [/Users/user/temp/MauiProj/MauiProj.sln]
/Users/user/temp/MauiProj/MauiProj.csproj : error NU1102: – Found 84 version(s) in nuget.org [ Nearest version: 7.0.0-preview.1.22076.8 ] [/Users/user/temp/MauiProj/MauiProj.sln]
/Users/user/temp/MauiProj/MauiProj.csproj : error NU1102: – Found 0 version(s) in /usr/local/share/dotnet/library-packs [/Users/user/temp/MauiProj/MauiProj.sln]

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Jin 1 Reputation point
    2022-05-27T12:47:01.097+00:00

    HI.

    There is no mention of linux. Its the csproj you get from the "dotnet new maui" command and it would have no reason to mention linux inside the csproj file I would think. I created another admin account on my mac and when I logged into that account the build and restore went without errors. So something in my home directory was causing it but since I didn't have the time so now I just wiped everything and started with a clean home directory for my main account. Its working now. VS Mac 2022 Maui preview also couldn't restore the nuget packages or build either when it was happening.


Your answer

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