Skip to content

Fix dotnetup CI builds - #55435

Merged
nagilson merged 2 commits into
dotnet:release/dnupfrom
dsplaisted:feature/dotnetup-crossbuild-runtime-arch
Jul 23, 2026
Merged

nagilson merged 2 commits into
dotnet:release/dnupfrom
dsplaisted:feature/dotnetup-crossbuild-runtime-arch

Conversation

@dsplaisted

Copy link
Copy Markdown
Member
  • Don't install mismatched architecture runtimes on cross-compile container builds
  • Update to VS2026 images to fix LNK1322 error

#55159 brought in changes to the repo install scripts from main which install test runtimes using the target architecture. This breaks cross-build container builds which run in the host architecture, as you end up with a dotnet folder with a mix of architectures.

So this PR simply skips installing those test runtimes when the target architecture differs from the host architecture (except in the MacOS/Rosetta case, where the output is runnable). Since the architectures differ the built product shouldn't be run on the same machine and those runtimes shouldn't be needed for testing anyway.

Probably these changes to the scripts should be applied to main, but I think we should check them in to release/dnup first to unblock getting updated daily builds (which stopped around July 13th).

dsplaisted and others added 2 commits July 23, 2026 10:28
…s-builds

eng/restore-toolset.{sh,ps1} installed the .NET test shared frameworks (6.0-10.0)
for the *target* architecture whenever TARGET_ARCHITECTURE differed from the host
machine architecture. On a genuine cross-compile (e.g. an x64 Linux/Windows agent
building arm64) those runtimes cannot run on the host, so placing them in the host
.dotnet pollutes it with un-runnable binaries. hostfxr then resolves the foreign
net6 for the NuGet credential provider during 'dotnet tool restore', which fails to
load libhostpolicy.so and breaks the build on every arm64 cross leg.

Only install test runtimes for an architecture the host can actually execute:
- Same arch as the host: install as before.
- macOS arm64 building x64: install x64 (runs via Rosetta 2) - preserved in .sh.
- Any other cross-compile (host cannot run the target): skip. Cross-build legs are
  build-only (runTests: false); real cross-arch tests run on native Helix agents.

This keeps the host .dotnet single-architecture so the net6 credential provider
rolls forward to the host runtime instead of tripping on an un-runnable target-arch
net6. Also removes the now-unused Get-DotNetInstallFallbackArchitecture helper.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f118977e-1e71-40b0-8045-10f5ab006715
Matches what main did in dotnet#55326

Should fix LNK1322 error
@dsplaisted
dsplaisted requested review from Copilot and nagilson July 23, 2026 15:28
@dsplaisted
dsplaisted requested a review from a team as a code owner July 23, 2026 15:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates dotnetup’s toolset restore/install scripts and dnup pipeline configuration to unblock CI by avoiding mixed-architecture runtime installs on cross-compile legs and by moving Windows jobs to VS2026 images/queues (addressing the reported LNK1322 failures).

Changes:

  • Skip installing “test runtimes” when TARGET_ARCHITECTURE differs from the host architecture (with a macOS arm64→x64 Rosetta exception in the Bash script).
  • Align dnup PR/CI pipelines to VS2026 Windows images and corresponding Helix target queues.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
eng/restore-toolset.sh Skips test-runtime installation on true cross-arch legs; allows macOS arm64 host targeting x64 (Rosetta) to proceed.
eng/restore-toolset.ps1 Skips test-runtime installation when TARGET_ARCHITECTURE differs from the host architecture on Windows.
.vsts-dnup-pr.yml Moves dnup PR validation to VS2026 image + updates Helix queue.
.vsts-dnup-ci.yml Moves dnup CI stages to VS2026 image + updates Helix queue.

Comment thread eng/restore-toolset.ps1
Comment on lines +48 to +54
$runtimeSpecs = @("6.0", "7.0", "8.0", "9.0", "10.0")
if ([string]::IsNullOrEmpty($installArch)) {
# Also install the exact runtime versions that arcade's toolset requires
# (from Version.Details.props) so tests can target those specific versions.
$runtimeSpecs += Get-CurrentRuntimeToolsetSpecs
}
InstallDotNetSharedFrameworks -RuntimeSpecs $runtimeSpecs -Architecture $installArch
@nagilson
nagilson enabled auto-merge July 23, 2026 16:16
@nagilson
nagilson disabled auto-merge July 23, 2026 18:19
@nagilson
nagilson merged commit 651d8cc into dotnet:release/dnup Jul 23, 2026
29 of 33 checks passed
nagilson added a commit that referenced this pull request Jul 27, 2026
On cross-build CI legs (e.g. x64 host building for arm64), the restore
scripts were installing target-architecture runtimes into the host
.dotnet folder. This caused libhostpolicy load failures when the NuGet
credential provider tried to resolve a shared framework built for the
wrong CPU architecture, breaking dotnet tool restore.

Skip installing test runtimes entirely when the target architecture
differs from the host (since the built product won't run on the build
machine anyway). Preserve the macOS Rosetta 2 exception where x64
binaries can run on arm64.

Port of the fix from release/dnup (PR #55435) to main.

Fixes #55457

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants