Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Fix CI/CD pipeline build errors for .NET Android workflow in PR #4#5

Merged
cail merged 3 commits into
masterfrom
copilot/fix-ci-cd-pipeline-errors
Oct 20, 2025
Merged

Fix CI/CD pipeline build errors for .NET Android workflow in PR #4#5
cail merged 3 commits into
masterfrom
copilot/fix-ci-cd-pipeline-errors

Conversation

Copilot AI commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

Overview

This PR fixes the GitHub Actions workflow build failures that were preventing PR #4 from building successfully. The workflow now successfully builds both the AndroidDrawing library and the example Android application with .NET 9.0 on Ubuntu latest.

Problem

The CI/CD pipeline was failing at the Android workload installation step with the following error:

Specify which project file to use because this '/home/runner/work/AndroidDrawing/AndroidDrawing' 
contains more than one project file.

The root cause was that dotnet workload install android was being executed in the repository root directory, which contains two .csproj files:

  • AndroidDrawing.csproj (legacy Xamarin project)
  • AndroidDrawing.dotnet.csproj (new .NET 9.0 project)

The workload installer couldn't determine which project to target and aborted with exit code 1.

Changes

1. Workflow Configuration Fix

Modified .github/workflows/build-dotnet-android.yml to run the Android workload installation from a directory containing only one project file:

- name: Install .NET Android workload
  working-directory: ${{ github.workspace }}/examples/CanvasExample
  run: dotnet workload install android

This eliminates the ambiguity by running the command in a directory with a single project file.

2. MAUI Package Version Resolution

Updated both AndroidDrawing.dotnet.csproj and examples/CanvasExample/CanvasExample.csproj to use an explicit MAUI version:

<!-- Before -->
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />

<!-- After -->
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.111" />

This fixes the NU1604 warning about missing lower bound in dependency version.

3. Android Manifest Target SDK

Added android:targetSdkVersion="35" to examples/CanvasExample/AndroidManifest.xml:

<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="35" />

This aligns with the build target (API level 35) and eliminates the XA1006 warning.

4. Type Naming Conflict Resolution

Renamed CanvasView to DrawingView in examples/CanvasExample/MainActivity.cs to avoid type naming conflicts between the example app and the library.

Verification

All workflow steps now execute successfully:

Checkout code - Uses actions/checkout@v4
Setup .NET - Installs .NET 9.0.x
Install Android workload - Completes without errors
Restore library dependencies - Succeeds
Build library - Produces bin/Release/net9.0-android/AndroidDrawing.dotnet.dll
Restore example app dependencies - Succeeds
Build example app - Produces examples/CanvasExample/bin/Release/net9.0-android/CanvasExample.dll

The builds complete with only minor warnings (deprecated Android Canvas.Matrix API) and no errors. The workflow is ready for GitHub Actions execution on push/PR to main/master branches.

Testing

Tested locally by running all workflow steps sequentially:

# Step 1: Install Android workload (from examples/CanvasExample)
dotnet workload install android

# Step 2-3: Build library
dotnet restore AndroidDrawing.dotnet.csproj
dotnet build AndroidDrawing.dotnet.csproj --configuration Release --no-restore

# Step 4-5: Build example app
dotnet restore examples/CanvasExample/CanvasExample.csproj
dotnet build examples/CanvasExample/CanvasExample.csproj --configuration Release --no-restore

All steps completed successfully with exit code 0.

Fixes #4

Original prompt

The CI/CD pipeline for building the .NET Android version of the AndroidDrawing library in PR #4 (#4) is encountering build errors. Fix all pipeline build errors in this PR so that the GitHub Actions workflow completes successfully for both the library and the example Android application. Ensure the workflow builds with .NET 9.0 and the Android workload, and all steps pass on Ubuntu latest. Also verify that the example app builds and runs as intended.

This pull request was created as a result of the following prompt from Copilot chat.

The CI/CD pipeline for building the .NET Android version of the AndroidDrawing library in PR #4 (#4) is encountering build errors. Fix all pipeline build errors in this PR so that the GitHub Actions workflow completes successfully for both the library and the example Android application. Ensure the workflow builds with .NET 9.0 and the Android workload, and all steps pass on Ubuntu latest. Also verify that the example app builds and runs as intended.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 20, 2025 07:18
Co-authored-by: cail <153030+cail@users.noreply.github.com>
Co-authored-by: cail <153030+cail@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI/CD pipeline build errors for AndroidDrawing library Fix CI/CD pipeline build errors for .NET Android workflow in PR #4 Oct 20, 2025
Copilot AI requested a review from cail October 20, 2025 07:33
@cail cail marked this pull request as ready for review October 20, 2025 09:29
@cail cail merged commit 37a4ea6 into master Oct 20, 2025
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants