CLI experience
If you try the samples here, you can run iOS/Android projects at the command-line with:
$ dotnet build HelloAndroid.csproj -t:Run
$ dotnet build HelloiOS.csproj -t:Run
$ dotnet run --project HelloAndroid.csproj
iOS behavior
iOS launches the first simulator it finds in the list (which is currently an iPad) and prints the iOS console output at the command-line and blocks. You have to Ctrl+C to get the dotnet
command to exit. You get an MSBuild error message after hitting Ctrl+C.
@rolfbjarne feel free to chime in 😄, there might be a way to select which simulator you want.
Android behavior
Android uses the existing adb
connection along with the AdbTarget
property if you need to select which device/emulator to use when there are multiple. The dotnet
command exits successfully when the app is launched, giving no console output for the app.
The Xamarin.Android SDK does not have any logic for locating emulators and launching them from MSBuild, as the IDEs do this for Android, currently. There is not any logic for giving adb logcat
(console) output either.
Can you dotnet run
apps? Like .apk
, .aab
, .app
, or .ipa
files?
There does not currently seem to be a way to do something like:
$ dotnet run bin/Debug/HelloAndroid.apk
$ dotnet run bin/Debug/HelloiOS.app
I think we would need some new behavior for the dotnet run
command for this to be possible. --project
runs MSBuild, so that is why we were able to get this part to work.
Conclusion
What should the behavior be here? Both iOS/Android behaviors are reasonable in their own way.