I feels pleasant working on Xamarin projects with VSCode in parallel with Jetbrains Rider IDE. It’s neccessary to find a way to build and run Xamarin.iOS and Xamarin.Android apps using command line and generate those scripts as tasks in VSCode for quick development.
Run Xamarin.Android project from command line
It is required to ensure that devices or simulator is already running. Invoke adb devices should have some result. Simulator can be run using Android SDK tool emulator. Example: ./emulator -avd Pixel_2_29
There are built-in MSBuild targets that take care of everything, from building to deploying. Have a look at this docs: https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-process#build-targets
- adb shell monkey is used to launch the installed app
- UpdateAndroidResources is useful when having trouble with the generated code in Resources.designer.cs or when editting resources file (i.e. strings.xml)
Run Xamarin.iOS project from command line
Example build and run Xamarin.iOS app on iPhone XR, iOS 12.4 simulator
msbuild /t:Build for building the Xamarin.iOS app bundle, output file YOUR_IOS_PROJECT_NAME.app in bin/iPhoneSimulator/Debug folder. There is no need for generating IPA file during development
mlaunch used for installing and launching the Xamarin.iOS app bundle on device or simulator. This is still closed source maintained by Xamarin team. But reading the help page would help using the tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -h
Explain steps to work with mlaunch
Locate mlaunch tool which usually locates at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch
Get list of simulators and save the runtime and devicetype value
- Construct argument and launch the app
- The message Press enter to terminate the application message will be shown when the app launch on simulator.