Build error MT0057 for .Net Maui iOS, Mac Catalyst builds with no problem

Chris Gonzales 21 Reputation points
2022-05-03T02:37:12.473+00:00

I can build and run for Mac Catalyst fine with this command

dotnet build -t:Run -f net6.0-maccatalyst MyApp.csproj

but when I try to build for iOS using this command

dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=********-************** MyApp.csproj

I get this error

EXEC : error MT0057: Cannot determine the path to Xcode.app from the sdk root '/Library/Developer/CommandLineTools'. Please specify the full path to the Xcode.app bundle. [/Users/chris/Documents/Development/MyApp/src/MyApp/MyApp.csproj]
`/usr/local/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(897,5): error MSB3073: The command "/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.2.302-preview.14.122/tools/bin/mlaunch --launchsim bin/Debug/net6.0-ios/iossimulator-x64/MyApp.app/ --device :v2:udid=********-************ --stdout /dev/ttys000 --stderr /dev/ttys000 --wait-for-exit" exited with code 1. [/Users/chris/Documents/Development/MyApp/src/MyApp/MyApp.csproj]

It is odd that it can find XCode for Catalyst but cannot find it for iOS. Any help would be appreciated.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,607 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 32,546 Reputation points Microsoft Vendor
    2022-05-05T01:25:05.703+00:00

    Hi @Chris Gonzales ,

    It prompts that there is something wrong with the path /Library/Developer/CommandLineTools, please open Xcode and check Xcode > Preferences > Locations > Command Line Tools.
    /usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.2.302-preview.14.122/tools/bin/mlaunch, the preview version is a little old, you could upgrade to the latest MAUI RC. The 15.2.302-preview.14.122 version on my side works fine, you could have a try.

    My Testing :

    1. Update : dotnet workload update
    2. Create a MAUI project : sudo dotnet new maui -n 'HelloMAUI'
    3. Build for iOS( cd to the project path, udid is the id of my simulator ) : dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=********-************** HelloMAUI.csproj

    Note: my Command Line Tools location is /Applications/Xcode.app

    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.


0 additional answers

Sort by: Most helpful

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.