diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 17e6bde..e5fcb21 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -180,6 +180,9 @@ jobs: - name: Build module run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework net9.0 --output ./publish/net9.0 + - name: Remove deps.json from publish output + run: rm -f ./publish/net9.0/PSProxmoxVE.deps.json + - name: Install Pester 5 shell: pwsh run: Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope CurrentUser diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 166cfab..b89a8a3 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -42,6 +42,10 @@ jobs: - name: Build module run: dotnet publish src/PSProxmoxVE/PSProxmoxVE.csproj --configuration Release --framework ${{ matrix.framework }} --output ./publish/${{ matrix.framework }} + - name: Remove deps.json from publish output + shell: bash + run: rm -f ./publish/${{ matrix.framework }}/PSProxmoxVE.deps.json + - name: Install Pester 5 (PS 5.1) if: matrix.ps_version == '5.1' shell: powershell diff --git a/tests/PSProxmoxVE.Tests/_TestHelper.ps1 b/tests/PSProxmoxVE.Tests/_TestHelper.ps1 index 57f9722..4696613 100644 --- a/tests/PSProxmoxVE.Tests/_TestHelper.ps1 +++ b/tests/PSProxmoxVE.Tests/_TestHelper.ps1 @@ -44,4 +44,9 @@ if ($null -eq $moduleDll) { throw "PSProxmoxVE.dll not found. Build the project before running Pester tests." } +# Remove deps.json if present — it causes assembly resolution conflicts +# when loading a binary module inside PowerShell's own .NET runtime. +$depsJson = Join-Path (Split-Path $moduleDll) 'PSProxmoxVE.deps.json' +if (Test-Path $depsJson) { Remove-Item $depsJson -Force } + Import-Module $moduleDll -Force -ErrorAction Stop