I have a MAUI application that I can run in any simulator I want in VS for Mac but I want to run the app in a simulator via the .NET command line. So I am running this command:
dotnet build -t:Run -f net7.0-ios /p:RuntimeIdentifier=iossimulator-x64 /p:DeviceName="iPhone 14 Pro Max"
This does build and run the app but it always builds in an 6th gen iPad Pro simulator regardless of what device I try to target. I can not find any reference to that specific iPad model anywhere in the csproj file or anywhere else. Does my command look valid? Why else might it always boot in 6th gen Ipad Pro?
If you need any further information please ask.
If you want to select which simulator you want via the .NET command line, you can follow the steps below:
Get into the folder /Applications/Xcode.app/Contents/Developer/usr/bin/
and then use command xcrun simctl list
to get a list of all the simulators.
Choose one you want to specify, and copy the corresponding UDID
.
In Terminal, build the app and run it on your chosen simulator by specifying the _DeviceName
MSBuild property using the -p
MSBuild option:
dotnet build -t:Run -f net8.0-ios -p:_DeviceName=:v2:udid=MY_SPECIFIC_UDID
For more details, you can refer to Launch the app on a specific simulator.