fix(build): add netstandard2.0 target to eliminate System.Runtime version mismatch

The net9.0 DLL references System.Runtime 9.0.0.0 which is unavailable
on GitHub runners where pwsh ships with .NET 8.x. Adding netstandard2.0
as a target produces a DLL compatible with any .NET version (PS 5.1 on
.NET Framework through PS 7.x on .NET 8/9).

- Add netstandard2.0 to TargetFrameworks in Core and module csproj
- Update #if NET48 conditionals to include NETSTANDARD2_0
- Switch CI workflows from net9.0 to netstandard2.0 for Pester tests
- Update _TestHelper.ps1 framework search order

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-19 09:34:40 -05:00
parent fca83caebc
commit b8af36a7fc
6 changed files with 22 additions and 19 deletions
+3 -5
View File
@@ -178,10 +178,10 @@ jobs:
# ── Build and test ─────────────────────────────────────────────────
- name: Build module
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework net9.0 --output ./publish/net9.0
run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework netstandard2.0 --output ./publish/netstandard2.0
- name: Clean publish output for PS module loading
run: rm -f ./publish/net9.0/*.deps.json ./publish/net9.0/*.runtimeconfig.json
run: rm -f ./publish/netstandard2.0/*.deps.json
- name: Install Pester 5
shell: pwsh
@@ -192,7 +192,7 @@ jobs:
run: |
$modulePath = "$HOME/.local/share/powershell/Modules/PSProxmoxVE"
New-Item -ItemType Directory -Path $modulePath -Force | Out-Null
Copy-Item -Path ./publish/net9.0/* -Destination $modulePath -Recurse -Force
Copy-Item -Path ./publish/netstandard2.0/* -Destination $modulePath -Recurse -Force
- name: Create test ISO
shell: bash
@@ -201,8 +201,6 @@ jobs:
- name: Run integration tests
shell: pwsh
env:
DOTNET_ROOT: ''
DOTNET_MULTILEVEL_LOOKUP: ''
PVETEST_HOST: ${{ steps.target.outputs.host }}
PVETEST_PORT: ${{ steps.target.outputs.port }}
PVETEST_APITOKEN: ${{ steps.target.outputs.token }}
+5 -5
View File
@@ -18,9 +18,9 @@ jobs:
- os: windows-latest
framework: net48
- os: windows-latest
framework: net9.0
framework: netstandard2.0
- os: ubuntu-latest
framework: net9.0
framework: netstandard2.0
steps:
- uses: actions/checkout@v5
@@ -58,17 +58,17 @@ jobs:
shell: powershell
- os: windows-latest
ps_version: '7.5'
framework: net9.0
framework: netstandard2.0
artifact_os: windows-latest
shell: pwsh
- os: ubuntu-latest
ps_version: '7.5'
framework: net9.0
framework: netstandard2.0
artifact_os: ubuntu-latest
shell: pwsh
- os: macos-latest
ps_version: '7.5'
framework: net9.0
framework: netstandard2.0
artifact_os: ubuntu-latest
shell: pwsh