Fix cross-compiled CLI bundles missing DCP (win-arm64, linux-arm64, linux-musl-x64)#15529
Fix cross-compiled CLI bundles missing DCP (win-arm64, linux-arm64, linux-musl-x64)#15529davidfowl wants to merge 2 commits intorelease/13.2from
Conversation
…nux-musl-x64 Bundle.proj's _RestoreDcpPackage target now maps TargetRid to BuildOs/BuildArch and passes them to the AppHost restore, ensuring the correct DCP NuGet package is downloaded for the target platform instead of the build machine's platform. CreateLayout now throws when DCP is not found instead of silently producing a broken bundle that would fail layout validation at runtime. Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/a71f0181-f863-4d63-b275-47c8eb198dee
…ormat Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/a71f0181-f863-4d63-b275-47c8eb198dee
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15529Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15529" |
There was a problem hiding this comment.
Pull request overview
This PR fixes cross-compilation of Aspire CLI bundles by ensuring the correct DCP NuGet package is restored for the target RID (rather than the build machine RID), and by preventing CreateLayout from producing bundles that are missing DCP.
Changes:
- Map
TargetRid→ DCPBuildOs/BuildArchineng/Bundle.projand pass them to the AppHost restore. - Fail fast in
tools/CreateLayoutwhen DCP cannot be found, instead of silently skipping it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| eng/Bundle.proj | Adds RID→(BuildOs, BuildArch) mapping and uses it during DCP restore so cross-compiled bundles restore the correct DCP package. |
| tools/CreateLayout/Program.cs | Throws an error when DCP is missing to avoid producing invalid layouts/bundles. |
| <_BundleBuildArch Condition="$(TargetRid.EndsWith('-x64'))">amd64</_BundleBuildArch> | ||
| <_BundleBuildArch Condition="$(TargetRid.EndsWith('-arm64'))">arm64</_BundleBuildArch> | ||
| <_BundleBuildArch Condition="$(TargetRid.EndsWith('-x86'))">386</_BundleBuildArch> |
There was a problem hiding this comment.
The new RID→BuildArch mapping includes -x86 → 386, but this repo doesn’t appear to ship a Microsoft.DeveloperControlPlane.*-386 package (Version.Details.xml lists amd64/arm64 variants only). As written, TargetRid=*-x86 would pass the mapping validation and then fail later during restore with a less actionable NuGet error. Consider removing the -x86 mapping (and updating the preceding comment) or explicitly erroring when TargetRid ends with -x86 so the failure is immediate and self-explanatory.
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
🎬 CLI E2E Test Recordings — 51 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23493903454 |
Description
Cherry-pick of #15522 to
release/13.2.Problem
Bundle.proj's_RestoreDcpPackagetarget runsdotnet restoreon the AppHost project to download the DCP (Developer Control Plane) NuGet package. The AppHost'sPackageDownloaduses$(BuildOs)-$(BuildArch)to select the platform-specific DCP package (e.g.,Microsoft.DeveloperControlPlane.windows-amd64).The problem is that
BuildOsandBuildArchare defined inDirectory.Build.propsand auto-detect from the build machine's OS/architecture:When cross-compiling (e.g., building a
win-arm64bundle on awin-x64CI agent), the restore downloads the build machine's DCP (windows-amd64) instead of the target's (windows-arm64).CreateLayoutthen silently skips the missing DCP, producing a bundle withmanaged/but nodcp/. This causes "no valid layout found" failures at runtime.Affected RIDs:
win-arm64,linux-arm64,linux-musl-x64— any RID where the target platform differs from the CI runner.Fix
eng/Bundle.proj: MapTargetRidtoBuildOs/BuildArchand pass them explicitly to the restore command so the correct DCP package is downloaded for the target platform.tools/CreateLayout/Program.cs: Promote missing DCP from a silent warning to a hard error, preventing broken bundles from being produced.Why a hand-rolled mapping instead of reusing
Aspire.RuntimeIdentifier.Tool?The repo already has
Aspire.RuntimeIdentifier.Tool(insrc/Aspire.AppHost.Sdk/) which uses NuGet's runtime graph (RuntimeGraph) to resolve the best-matching RID for a platform. The Aspire SDK used this to select the correct Dashboard and DCP packages at build time (see PR #5695).However, it can't be directly reused here because DCP packages use Go-style naming conventions, not NuGet RIDs:
win-x64windows-amd64osx-arm64darwin-arm64linux-musl-x64linux-musl-amd64The tool resolves
win-x64from the runtime graph, but the DCP package is namedMicrosoft.DeveloperControlPlane.windows-amd64. So a mapping from NuGet RID conventions → DCP naming (win→windows,osx→darwin,x64→amd64) is still required regardless. The mapping is ~6 lines of MSBuild conditions inBundle.proj, which is pragmatic for a servicing fix.Eliminating this mapping entirely would require the DCP packages to adopt NuGet RID naming, which is outside this repo's control.
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: