Skip to content

Commit 9fa393b

Browse files
committed
Select the NativeAOT runtime pack as the target package when it's provided as part of the KnownILCompilerPack metadata.
Depends on dotnet/runtime#111876
1 parent 83cd168 commit 9fa393b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Installer/redist-installer/targets/GenerateBundledVersions.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ Copyright (c) .NET Foundation. All rights reserved.
572572
<KnownILCompilerPack Include="Microsoft.DotNet.ILCompiler"
573573
TargetFramework="net10.0"
574574
ILCompilerPackNamePattern="runtime.**RID**.Microsoft.DotNet.ILCompiler"
575+
ILCompilerRuntimePackNamePattern="Microsoft.NETCore.App.Runtime.NativeAOT.**RID**"
575576
ILCompilerPackVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)"
576577
ILCompilerRuntimeIdentifiers="@(ILCompilerSupportedRids, '%3B')"
577578
/>

src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,20 @@ private ToolPackSupport AddToolPack(
846846
{
847847
return ToolPackSupport.UnsupportedForTargetRuntimeIdentifier;
848848
}
849-
if (!hostRuntimeIdentifier.Equals(targetRuntimeIdentifier))
849+
850+
// If we have a separate pack pattern for the runtime pack,
851+
// we should always use the runtime pack (the host pack may not have the tooling we need for the target).
852+
bool useRuntimePackForAllTargets = false;
853+
string targetPackNamePattern = packNamePattern;
854+
if (knownPack.GetMetadata("ILCompilerRuntimePackNamePattern") is string runtimePackNamePattern)
855+
{
856+
targetPackNamePattern = runtimePackNamePattern;
857+
useRuntimePackForAllTargets = true;
858+
}
859+
860+
if (useRuntimePackForAllTargets || !hostRuntimeIdentifier.Equals(targetRuntimeIdentifier))
850861
{
851-
var targetIlcPackName = packNamePattern.Replace("**RID**", targetRuntimeIdentifier);
862+
var targetIlcPackName = targetPackNamePattern.Replace("**RID**", targetRuntimeIdentifier);
852863
var targetIlcPack = new TaskItem(targetIlcPackName);
853864
targetIlcPack.SetMetadata(MetadataKeys.NuGetPackageId, targetIlcPackName);
854865
targetIlcPack.SetMetadata(MetadataKeys.NuGetPackageVersion, packVersion);

0 commit comments

Comments
 (0)