Freezing command-line build of a .NET MAUI Blazor App

Viewed 445

I'm using VS 2022 Preview 5 together with Maui Preview 9 and .NET 6.0.100-rc.2.21505.57

With that, I'm using the new project template ".NET MAUI Blazor App", where MAUI hosts a WebView in which Blazor is running. This enables building hybrid Blazor Apps cross-platform.

Project Template Name

Simply starting with the newly scaffolded project off the shelf, I can use Visual Studio to compile and run on Windows Desktop, Android Emulator and my physical Android device. So far, so shiny.

My goal is to figure out how to build for Android on the command line, however, to be able to set up a CI pipeline for those builds. So I thought I'd start by looking for the *-signed.apk that VS produces while building, and as a first test deploy that to the emulator by running adb install path/to/myproject-signed.apk

Here's the catch: This apk simply leaves the emulator hanging with the default .NET splash screen for these applications.

enter image description here

My question is: Which command should I issue on the command-line to generate an apk that works on the mobile device? I tried the following two options:

  • dotnet build -f net6.0-android creates the same hanging application when installed via adb
  • dotnet build -c Release -f net6.0-android yields a bigger apk, but the application crashes during startup
0 Answers
Related