MAUI Android Azure Pipelines Install & Build only Android

234 Views Asked by At

I'm able to successfully Install/Build MAUI using the full commands:

  - task: UseDotNet@2
    displayName: 'install net core sdk'
    inputs:
      version: 8.0.x
      performMultiLevelLookup: true
      includePreviewVersions: true # Required for preview versions

  - task: CmdLine@2
    inputs:
      script: 'dotnet workload install maui'
    displayName: 'install maui'
      #script: 'dotnet workload install android'

  - task: DotNetCoreCLI@2
    inputs:
      command: 'build'
      projects: 'MauiMaestroApp.sln'
      #projects: 'MauiMaestroApp/MauiMaestroApp.csproj'
      arguments: '-c Release -f net8.0-android'
    displayName: 'build'

I'm trying to slim this down so that it only needs to target and build Android. I have no need to install/build IOS, etc. What am I missing to accomplish this?

1

There are 1 best solutions below

0
Mansel On

You're almost there.

Your arguments for the DotNetCoreCLI@2 task specify targeting Android so that it won't build iOS.

What you can do in the second task where you install the MAUI workload, is trim this down by specifiying to install MAUI Android only:

  - task: CmdLine@2
    inputs:
      script: 'dotnet workload install maui-android'
    displayName: 'install maui'