diff --git a/src/Installer/redist-installer/targets/GenerateBundledVersions.targets b/src/Installer/redist-installer/targets/GenerateBundledVersions.targets index 3d0600418a92..2f51499049f5 100644 --- a/src/Installer/redist-installer/targets/GenerateBundledVersions.targets +++ b/src/Installer/redist-installer/targets/GenerateBundledVersions.targets @@ -572,6 +572,7 @@ Copyright (c) .NET Foundation. All rights reserved. diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs index e494e717d04f..0c09043f6722 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs @@ -846,9 +846,20 @@ private ToolPackSupport AddToolPack( { return ToolPackSupport.UnsupportedForTargetRuntimeIdentifier; } - if (!hostRuntimeIdentifier.Equals(targetRuntimeIdentifier)) + + // If we have a separate pack pattern for the runtime pack, + // we should always use the runtime pack (the host pack may not have the tooling we need for the target). + bool useRuntimePackForAllTargets = false; + string targetPackNamePattern = packNamePattern; + if (knownPack.GetMetadata("ILCompilerRuntimePackNamePattern") is string runtimePackNamePattern) + { + targetPackNamePattern = runtimePackNamePattern; + useRuntimePackForAllTargets = true; + } + + if (useRuntimePackForAllTargets || !hostRuntimeIdentifier.Equals(targetRuntimeIdentifier)) { - var targetIlcPackName = packNamePattern.Replace("**RID**", targetRuntimeIdentifier); + var targetIlcPackName = targetPackNamePattern.Replace("**RID**", targetRuntimeIdentifier); var targetIlcPack = new TaskItem(targetIlcPackName); targetIlcPack.SetMetadata(MetadataKeys.NuGetPackageId, targetIlcPackName); targetIlcPack.SetMetadata(MetadataKeys.NuGetPackageVersion, packVersion);