fix: Force net8.0 target framework in test workflow

Add -p:TargetFramework=net8.0 to all dotnet commands in test workflow
to prevent transitive restoration of iOS/macOS target frameworks.

**Problem**:
- Test project references main HihaArvio project
- Main project has multi-target frameworks (net8.0, net8.0-ios, net8.0-maccatalyst)
- Restoring test project transitively restores all target frameworks
- iOS/macOS frameworks require macOS-specific workloads
- These workloads don't exist on Ubuntu runners

**Solution**:
Add `-p:TargetFramework=net8.0` to:
- dotnet restore (only restore for net8.0)
- dotnet build (only build for net8.0)
- dotnet test (only test for net8.0)

**Verification**:
Tested locally - all 189 tests pass with this approach.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-18 14:08:13 +02:00
parent 571b783054
commit b903941a4c

View File

@@ -21,13 +21,13 @@ jobs:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore tests/HihaArvio.Tests/HihaArvio.Tests.csproj
run: dotnet restore tests/HihaArvio.Tests/HihaArvio.Tests.csproj -p:TargetFramework=net8.0
- name: Build test project
run: dotnet build tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-restore
run: dotnet build tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-restore -p:TargetFramework=net8.0
- name: Run tests
run: dotnet test tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
run: dotnet test tests/HihaArvio.Tests/HihaArvio.Tests.csproj --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 --logger "trx;LogFileName=test-results.trx"
- name: Publish test results
uses: dorny/test-reporter@v1