fix(ci): remove all deps/runtimeconfig json and unset DOTNET_ROOT in-process

Previous approach of env: DOTNET_ROOT='' at the step level wasn't
sufficient — the .NET runtime may have already cached the original
DOTNET_ROOT before pwsh started. Now:

- Remove *.deps.json AND *.runtimeconfig.json from publish output
- Unset DOTNET_ROOT via $env:DOTNET_ROOT = $null inside the pwsh script
- _TestHelper.ps1 also unsets DOTNET_ROOT and cleans deps/runtimeconfig

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-19 09:06:24 -05:00
parent afb1693f94
commit 35805959f4
3 changed files with 21 additions and 11 deletions
+2 -2
View File
@@ -180,8 +180,8 @@ 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: Clean publish output for PS module loading
run: rm -f ./publish/net9.0/*.deps.json ./publish/net9.0/*.runtimeconfig.json
- name: Install Pester 5
shell: pwsh
+7 -5
View File
@@ -43,9 +43,9 @@ 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
- name: Clean publish output for PS module loading
shell: bash
run: rm -f ./publish/${{ matrix.framework }}/PSProxmoxVE.deps.json
run: rm -f ./publish/${{ matrix.framework }}/*.deps.json ./publish/${{ matrix.framework }}/*.runtimeconfig.json
- name: Install Pester 5 (PS 5.1)
if: matrix.ps_version == '5.1'
@@ -111,10 +111,12 @@ jobs:
- name: Run Pester tests (PS 7.x)
if: matrix.ps_version != '5.1'
shell: pwsh
env:
DOTNET_ROOT: ''
DOTNET_MULTILEVEL_LOOKUP: ''
run: |
# Prevent setup-dotnet's DOTNET_ROOT from overriding PS's bundled runtime
[Environment]::SetEnvironmentVariable('DOTNET_ROOT', $null)
[Environment]::SetEnvironmentVariable('DOTNET_MULTILEVEL_LOOKUP', $null)
$env:DOTNET_ROOT = $null
$env:DOTNET_MULTILEVEL_LOOKUP = $null
Import-Module Pester -MinimumVersion 5.0
$config = New-PesterConfiguration
$config.Run.Path = "tests/PSProxmoxVE.Tests"