Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 20 additions & 2 deletions eng/Bundle.proj
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,27 @@
<Target Name="_RestoreDcpPackage">
<PropertyGroup>
<_DcpBinlog Condition="'$(ContinuousIntegrationBuild)' == 'true'">-bl:$(ArtifactsLogDir)RestoreDcp.binlog</_DcpBinlog>

<!-- Map TargetRid to DCP BuildOs/BuildArch so the AppHost restore downloads
the correct DCP package for the target platform, not the build machine's platform.
Without this, cross-compiled bundles (e.g., win-arm64 built on win-x64) would
be missing DCP because the default BuildOs/BuildArch resolve to the build machine.

Supported RID format: {os}-{arch} where os is win/osx/linux/linux-musl
and arch is x64/arm64/x86. Update this mapping when adding new RID patterns. -->
<_BundleBuildOs Condition="$(TargetRid.StartsWith('win-'))">windows</_BundleBuildOs>
<_BundleBuildOs Condition="$(TargetRid.StartsWith('osx-'))">darwin</_BundleBuildOs>
<_BundleBuildOs Condition="$(TargetRid.StartsWith('linux-musl-'))">linux-musl</_BundleBuildOs>
<_BundleBuildOs Condition="'$(_BundleBuildOs)' == '' and $(TargetRid.StartsWith('linux-'))">linux</_BundleBuildOs>

<_BundleBuildArch Condition="$(TargetRid.EndsWith('-x64'))">amd64</_BundleBuildArch>
<_BundleBuildArch Condition="$(TargetRid.EndsWith('-arm64'))">arm64</_BundleBuildArch>
<_BundleBuildArch Condition="$(TargetRid.EndsWith('-x86'))">386</_BundleBuildArch>
Comment on lines +122 to +124
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The new RID→BuildArch mapping includes -x86386, 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.

Copilot uses AI. Check for mistakes.
</PropertyGroup>
<Message Importance="high" Text="Restoring DCP package..." />
<Exec Command="dotnet restore &quot;$(AppHostProjectPath)&quot; $(_DcpBinlog)" />
<Error Condition="'$(_BundleBuildOs)' == '' or '$(_BundleBuildArch)' == ''"
Text="Could not map TargetRid '$(TargetRid)' to DCP BuildOs/BuildArch. Supported RID patterns: win-x64, win-arm64, linux-x64, linux-arm64, linux-musl-x64, osx-x64, osx-arm64." />
<Message Importance="high" Text="Restoring DCP package for $(TargetRid) (BuildOs=$(_BundleBuildOs), BuildArch=$(_BundleBuildArch))..." />
<Exec Command="dotnet restore &quot;$(AppHostProjectPath)&quot; /p:BuildOs=$(_BundleBuildOs) /p:BuildArch=$(_BundleBuildArch) $(_DcpBinlog)" />
</Target>

<Target Name="_RunCreateLayout">
Expand Down
6 changes: 4 additions & 2 deletions tools/CreateLayout/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ private Task CopyDcpAsync()
var dcpPath = FindDcpPath();
if (dcpPath is null)
{
Log(" WARNING: DCP not found. Skipping.");
return Task.CompletedTask;
throw new InvalidOperationException(
$"DCP package not found for RID '{_rid}'. " +
$"Ensure the DCP NuGet package for the target platform is restored before running CreateLayout. " +
$"A bundle without DCP would fail layout validation at runtime.");
}

var dcpDir = Path.Combine(_outputPath, "dcp");
Expand Down
Loading