From 6ab9fcadfbeaceb9412300f6ea3740918f11e51f Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 18 Nov 2025 14:22:37 +0200 Subject: [PATCH] fix: Specify target framework during restore in build workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add -f parameter to dotnet restore commands to ensure assets are generated for the specific target framework being built. **Problem**: - dotnet restore without -f flag restores all target frameworks - But assets file (project.assets.json) might not include runtime identifiers - Build fails with: "Assets file doesn't have a target for 'net8.0-maccatalyst/maccatalyst-x64'" - Error NETSDK1047 when using --no-restore flag **Solution**: Explicitly restore for each target framework before building: - iOS job: dotnet restore -f net8.0-ios - macOS job: dotnet restore -f net8.0-maccatalyst This ensures the assets file includes the correct runtime identifiers (iossimulator-arm64, maccatalyst-x64, etc.) needed for the build. **Changes**: - build.yml: Add -f to restore for iOS and macOS jobs - publish.yml: Add -f to restore for iOS and macOS jobs - Updated step names for clarity **Why This Works**: The -f flag tells restore to generate assets for that specific TFM and its associated RuntimeIdentifiers, which the build step requires. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/build.yml | 8 ++++---- .github/workflows/publish.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 202c6cb..cbdd521 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,8 @@ jobs: - name: Restore workloads run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - - name: Restore dependencies - run: dotnet restore src/HihaArvio/HihaArvio.csproj + - name: Restore dependencies for iOS + run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-ios - name: Build iOS run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-ios -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false @@ -55,8 +55,8 @@ jobs: - name: Restore workloads run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - - name: Restore dependencies - run: dotnet restore src/HihaArvio/HihaArvio.csproj + - name: Restore dependencies for macOS Catalyst + run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst - name: Build macOS Catalyst run: dotnet build src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst -c Release --no-restore /p:ArchiveOnBuild=false /p:EnableCodeSigning=false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 783f498..1d79280 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -101,8 +101,8 @@ jobs: - name: Restore workloads run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - - name: Restore dependencies - run: dotnet restore src/HihaArvio/HihaArvio.csproj + - name: Restore dependencies for iOS + run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-ios - name: Build iOS Release run: | @@ -148,8 +148,8 @@ jobs: - name: Restore workloads run: dotnet workload restore src/HihaArvio/HihaArvio.csproj - - name: Restore dependencies - run: dotnet restore src/HihaArvio/HihaArvio.csproj + - name: Restore dependencies for macOS Catalyst + run: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-maccatalyst - name: Build macOS Catalyst Release run: |