Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Maui Build Error Could not find Microsoft.iOS

Tags:

ios

publish

maui

I am on a PC Visual Studio CE 2022 attempting to archive and deploy for iOS. I am using the following command:

dotnet publish PopUpShop.Mobile.Maui -f net7.0-ios -c Release /p:ServerAddress=192.168.1.XXX /p:ServerUser='username' /p:TcpPort=58181 /p:ArchiveOnBuild=true

The process builds and connects to my Macbook but then throws this error:

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.1.1477\tools\msbuild\iOS\Xamarin.Shared.targets(1738,3): error : Could not find Microsoft.iOS in /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.1.1477/

I am not quite sure where it is looking for /usr/local/share.... I assume that is on the Macbook.

Do I have to install that version of the SDK on the Macbook? If so how do I do that? (Not a mac user). I tried in Terminal

dotnet add package Microsoft.iOS.Sdk --version 16.1.1477

but it wants to add that to a specific project.

like image 857
Cef Avatar asked Oct 24 '25 14:10

Cef


2 Answers

My solution is from Visual Studio in PC, I pair it to my Mac and it will automatically reinstall everything for me.

If somehow I cannot connect to my Mac or got some problem, I will do this step :

[1] --> in Mac open "$HOME/Library/Caches/Xamarin" --> move to trash the XMA folder

[2] -->in local windows del %localappdata%\Temp\Xamarin\XMA

[3] Restart visual studio

like image 194
Fitri Halim Avatar answered Oct 26 '25 03:10

Fitri Halim


The problem was I was missing the /p:_DotNetRootRemoteDirectory='/Users/{mac_os_username}/Library/Caches/Xamarin/XMA/SDKs/dotnet/' parameter. For some reason it was not part of the cli string I copied. The error message doesn't help either, sends you down a rabbit hole.

like image 20
Cef Avatar answered Oct 26 '25 04:10

Cef



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!