From b138955473b479708bf542279dccb3faf6f02e29 Mon Sep 17 00:00:00 2001 From: ahall Date: Tue, 7 Jul 2026 13:01:40 +0100 Subject: [PATCH 1/3] ci: add build-samples workflow for Phase 2 Windows-only heads (#510) Adds windows-latest CI coverage for the WinUI3, WPF, and MAUI (Windows TFM) TodoApp heads, plus the todoapp-tutorial ClientApp (WPF) head that Phase 1 (#509) explicitly deferred. - New build-samples-todoapp-windows.yml builds TodoApp.WinUI3.csproj (with -p:Platform=x64, required since the project declares x86/x64/ARM64 with no AnyCPU), TodoApp.WPF.csproj, and TodoApp.MAUI.csproj scoped to net10.0-windows10.0.19041.0 only (the maui-windows workload is installed first; Android/iOS heads remain out of scope, tracked in #511). - build-samples-todoapp-tutorial.yml gains a second job that builds ClientApp.csproj (WPF) on windows-latest, alongside the existing ServerApp job on ubuntu-latest. - build-samples.yml wires the new todoapp-windows job into the orchestrator and its all-samples-built gate. --- .../build-samples-todoapp-tutorial.yml | 35 +++++++--- .../build-samples-todoapp-windows.yml | 67 +++++++++++++++++++ .github/workflows/build-samples.yml | 8 ++- 3 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/build-samples-todoapp-windows.yml diff --git a/.github/workflows/build-samples-todoapp-tutorial.yml b/.github/workflows/build-samples-todoapp-tutorial.yml index ad553c2..8e9435a 100644 --- a/.github/workflows/build-samples-todoapp-tutorial.yml +++ b/.github/workflows/build-samples-todoapp-tutorial.yml @@ -8,17 +8,16 @@ env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_NOLOGO: true DOTNET_CONFIGURATION: 'Release' - # NOTE: This sample's solution (todoapp.sln) also contains ClientApp, a WPF project - # targeting net10.0-windows. That head requires a windows-latest runner and is tracked - # separately in https://github.com/CommunityToolkit/Datasync/issues/510 (Phase 2). Only - # ServerApp (net10.0) is built here. - ProjectFile: 'samples/todoapp-tutorial/ServerApp/ServerApp.csproj' + ServerProjectFile: 'samples/todoapp-tutorial/ServerApp/ServerApp.csproj' + # ClientApp is a WPF project targeting net10.0-windows, so it is built on a windows-latest + # runner in a separate job below. See https://github.com/CommunityToolkit/Datasync/issues/510. + ClientProjectFile: 'samples/todoapp-tutorial/ClientApp/ClientApp.csproj' permissions: contents: read jobs: - build: + build-serverapp: runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -30,10 +29,30 @@ jobs: dotnet-version: ${{ env.DOTNET_VERSION }} - name: Restore dependencies - run: dotnet restore ${{ env.ProjectFile }} + run: dotnet restore ${{ env.ServerProjectFile }} - name: Build sample run: > - dotnet build ${{ env.ProjectFile }} + dotnet build ${{ env.ServerProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore + + build-clientapp: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v7 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Restore dependencies + run: dotnet restore ${{ env.ClientProjectFile }} + + - name: Build sample + run: > + dotnet build ${{ env.ClientProjectFile }} --configuration ${{ env.DOTNET_CONFIGURATION }} --no-restore diff --git a/.github/workflows/build-samples-todoapp-windows.yml b/.github/workflows/build-samples-todoapp-windows.yml new file mode 100644 index 0000000..4bba7f8 --- /dev/null +++ b/.github/workflows/build-samples-todoapp-windows.yml @@ -0,0 +1,67 @@ +name: Build Sample - TodoApp Windows (WinUI3 / WPF / MAUI) + +on: + workflow_call: + +env: + DOTNET_VERSION: '10.0.x' + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + DOTNET_CONFIGURATION: 'Release' + # WinUI3 declares x86;x64;ARM64 with no AnyCPU, so Platform must be + # specified explicitly - the CLI default of AnyCPU is not a valid configuration for this project. + WinUI3ProjectFile: 'samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj' + WpfProjectFile: 'samples/todoapp/TodoApp.WPF/TodoApp.WPF.csproj' + # TodoApp.MAUI.csproj targets net10.0-android;net10.0-ios, with net10.0-windows10.0.19041.0 + # conditionally appended only when building on Windows. Android/iOS heads require separate + # workloads and are tracked in https://github.com/CommunityToolkit/Datasync/issues/511 (Phase 3), + # so restore/build here is explicitly scoped to the Windows TargetFramework only. + MauiProjectFile: 'samples/todoapp/TodoApp.MAUI/TodoApp.MAUI.csproj' + MauiWindowsTargetFramework: 'net10.0-windows10.0.19041.0' + +permissions: + contents: read + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v7 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Restore WinUI3 project + run: dotnet restore ${{ env.WinUI3ProjectFile }} -p:Platform=x64 + + - name: Build WinUI3 project + run: > + dotnet build ${{ env.WinUI3ProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + -p:Platform=x64 + --no-restore + + - name: Restore WPF project + run: dotnet restore ${{ env.WpfProjectFile }} + + - name: Build WPF project + run: > + dotnet build ${{ env.WpfProjectFile }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore + + - name: Install MAUI Windows workload + run: dotnet workload install maui-windows + + - name: Restore MAUI project (Windows TFM only) + run: dotnet restore ${{ env.MauiProjectFile }} -f ${{ env.MauiWindowsTargetFramework }} + + - name: Build MAUI project (Windows TFM only) + run: > + dotnet build ${{ env.MauiProjectFile }} + -f ${{ env.MauiWindowsTargetFramework }} + --configuration ${{ env.DOTNET_CONFIGURATION }} + --no-restore diff --git a/.github/workflows/build-samples.yml b/.github/workflows/build-samples.yml index bc07f02..31faae6 100644 --- a/.github/workflows/build-samples.yml +++ b/.github/workflows/build-samples.yml @@ -31,9 +31,12 @@ jobs: todoapp-avalonia: uses: ./.github/workflows/build-samples-todoapp-avalonia.yml + todoapp-windows: + uses: ./.github/workflows/build-samples-todoapp-windows.yml + # Single aggregation point so branch protection only needs to require one check, - # regardless of how many sample workflows are added over time (see Phase 2/3 - # follow-ups: https://github.com/CommunityToolkit/Datasync/issues/510 and #511). + # regardless of how many sample workflows are added over time (see Phase 3 + # follow-up: https://github.com/CommunityToolkit/Datasync/issues/511). all-samples-built: name: All samples built if: always() @@ -44,6 +47,7 @@ jobs: - todoapp-blazor-wasm - todoapp-tutorial - todoapp-avalonia + - todoapp-windows runs-on: ubuntu-latest steps: - name: Check sample build results From 052980a5cdf7cad8efff3abab45f4bdf914e4ebf Mon Sep 17 00:00:00 2001 From: ahall Date: Tue, 7 Jul 2026 13:16:27 +0100 Subject: [PATCH 2/3] fix: remove dangling PublishProfile from TodoApp.WinUI3 (NETSDK1198) 'dotnet build' on windows-latest (added in this PR's new build-samples-todoapp-windows.yml job) surfaces NETSDK1198: the project references a 'win-$(Platform).pubxml' publish profile that has never existed in the repo (no Properties/PublishProfiles folder checked in). It's benign scaffold metadata from an incomplete WinUI3 template setup with no effect on 'dotnet build' output, but it's dangling and unused, so remove it rather than suppress the warning. --- samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj b/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj index 890eaff..b72dafe 100644 --- a/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj +++ b/samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj @@ -7,7 +7,6 @@ app.manifest x86;x64;ARM64 win-x86;win-x64;win-arm64 - win-$(Platform).pubxml true true preview From e7c0d42ede3f8224d7b79d32fcd2bb71d106e469 Mon Sep 17 00:00:00 2001 From: ahall Date: Tue, 7 Jul 2026 13:18:29 +0100 Subject: [PATCH 3/3] fix: use -p:TargetFramework instead of -f for MAUI restore in todoapp-windows 'dotnet restore' has no --framework option; -f on restore means --force (a boolean flag), unlike 'dotnet build' where -f/--framework is a real option. Passing '-f net10.0-windows10.0.19041.0' caused restore to interpret the TFM string as a second positional project argument, failing with MSB1008 ("Only one project can be specified"). Scope restore to the single Windows TFM via the MSBuild property instead. --- .github/workflows/build-samples-todoapp-windows.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-samples-todoapp-windows.yml b/.github/workflows/build-samples-todoapp-windows.yml index 4bba7f8..73fba07 100644 --- a/.github/workflows/build-samples-todoapp-windows.yml +++ b/.github/workflows/build-samples-todoapp-windows.yml @@ -57,7 +57,9 @@ jobs: run: dotnet workload install maui-windows - name: Restore MAUI project (Windows TFM only) - run: dotnet restore ${{ env.MauiProjectFile }} -f ${{ env.MauiWindowsTargetFramework }} + # NOTE: 'dotnet restore' has no -f|--framework option (-f means --force there, unlike + # 'dotnet build'). Use the MSBuild property directly to scope restore to one TFM. + run: dotnet restore ${{ env.MauiProjectFile }} -p:TargetFramework=${{ env.MauiWindowsTargetFramework }} - name: Build MAUI project (Windows TFM only) run: >