Skip to content

Commit 1afccdf

Browse files
committed
ci: install the Windows .NET SDK per architecture
The UseDotNet@2 task has no architecture input and mis-detects Windows-on-Arm agents as win-x86, installing the 32-bit SDK. Publishing win-arm64 from an x86 host is then treated as Native AOT cross-compilation (only x64->arm64 is supported), so the ILCompiler step fails demanding a runtime.win-arm64.Microsoft.DotNet.ILCompiler package. The x86/x64 legs pass because they run on Intel agents, where the SDK targets win-x64 natively and win-x86 via bundled cross-support. Acquire the SDK with the official dotnet-install script instead, keyed on the matrix leg's poolArch, so every Windows agent gets a host SDK matching its architecture and publishes natively. The macOS and Linux legs keep UseDotNet@2; the mis-detection is specific to Windows on Arm. Assisted-by: Claude Opus 4.8 Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 96e431d commit 1afccdf

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.azure-pipelines/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,21 @@ extends:
134134
artifactName: '${{ dim.runtime }}'
135135
steps:
136136
- checkout: self
137-
- task: UseDotNet@2
138-
displayName: 'Use .NET 10 SDK'
137+
- task: PowerShell@2
138+
displayName: 'Install .NET 10 SDK'
139139
inputs:
140-
packageType: sdk
141-
version: '10.x'
140+
targetType: inline
141+
script: |
142+
# UseDotNet@2 mis-detects Windows-on-Arm agents as win-x86
143+
# and installs the 32-bit SDK, which breaks the win-arm64
144+
# AOT publish. Call dotnet-install directly, keyed on the
145+
# agent architecture, so each leg gets a matching host SDK.
146+
$ProgressPreference = 'SilentlyContinue'
147+
$installDir = Join-Path $env:AGENT_TEMPDIRECTORY 'dotnet'
148+
$installer = Join-Path $env:AGENT_TEMPDIRECTORY 'dotnet-install.ps1'
149+
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile $installer
150+
& $installer -Channel 10.0 -Architecture ${{ dim.poolArch }} -InstallDir $installDir
151+
Write-Host "##vso[task.prependpath]$installDir"
142152
# Native AOT links the published binary with the MSVC linker,
143153
# which the hosted images do not ship by default. Install the
144154
# VC++ build tools for the agent's architecture first.

0 commit comments

Comments
 (0)