Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/windows_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,51 @@ jobs:
working-directory: ${{ github.workspace }}

- name: Use .NET 8.x
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.x'
env:
PROCESSOR_ARCHITECTURE: x86 # x86 .NET

- name: Prefer x86 dotnet on PATH
shell: pwsh
run: |
$x86DotnetDir = 'C:\Program Files (x86)\dotnet'
$x64DotnetDir = 'C:\Program Files\dotnet'
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
Write-Host "Machine PATH: $machinePath"
Comment thread
eserscor marked this conversation as resolved.

$pathEntries = @($env:PATH -split ';' | Where-Object { $_ })
$reorderedPathEntries = @(
$x86DotnetDir
$pathEntries | Where-Object { $_ -ne $x86DotnetDir }
Comment thread
eserscor marked this conversation as resolved.
)

$env:PATH = ($reorderedPathEntries -join ';')

# Only add the x86 dotnet directory to GITHUB_PATH if it is not already on PATH (after normalization)
$normalizedX86DotnetDir = $x86DotnetDir.TrimEnd('\')
$normalizedPathEntries = $pathEntries | ForEach-Object { $_.TrimEnd('\') }
if (-not ($normalizedPathEntries -contains $normalizedX86DotnetDir)) {
Add-Content -Path $env:GITHUB_PATH -Value $x86DotnetDir
}
$dotnetPaths = @(Get-Command dotnet -All | Select-Object -ExpandProperty Source -Unique)
Write-Host 'Resolved dotnet executables:'
$dotnetPaths | ForEach-Object { Write-Host $_ }

$x86DotnetExe = "$x86DotnetDir\dotnet.exe"
$x64DotnetExe = "$x64DotnetDir\dotnet.exe"
$x86Index = $dotnetPaths.IndexOf($x86DotnetExe)
$x64Index = $dotnetPaths.IndexOf($x64DotnetExe)
Comment thread
eserscor marked this conversation as resolved.

if ($x86Index -lt 0) {
throw "Expected x86 dotnet executable was not found: $x86DotnetExe"
}
Comment thread
eserscor marked this conversation as resolved.

if ($x64Index -ge 0 -and $x86Index -gt $x64Index) {
throw "x86 dotnet must appear before x64 dotnet on PATH. Found $x86DotnetExe after $x64DotnetExe."
}

- name: Use Nuget 6.x
uses: nuget/setup-nuget@v2
with:
Expand Down
Loading