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: 13 additions & 9 deletions src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ protected override void ExecuteCore()
List<ITaskItem> runtimePacks = new List<ITaskItem>();
List<ITaskItem> unavailableRuntimePacks = new List<ITaskItem>();

HashSet<string> knownRuntimeIdentifierPlatforms = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
HashSet<string> unrecognizedRuntimeIdentifiers = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

bool windowsOnlyErrorLogged = false;
Expand Down Expand Up @@ -207,14 +206,6 @@ protected override void ExecuteCore()
string runtimePackName = runtimePackNamePattern.Replace("**RID**", runtimeIdentifier);
preferredPackages.Add(runtimePackName);
}

// Update the known runtime identifier platforms based on the selected Microsoft.NETCore.App pack
if (selectedRuntimePack.Value.Name.Equals("Microsoft.NETCore.App", StringComparison.OrdinalIgnoreCase))
{
int separator = runtimeIdentifier.LastIndexOf('-');
string platform = separator < 0 ? runtimeIdentifier : runtimeIdentifier.Substring(0, separator);
knownRuntimeIdentifierPlatforms.Add(platform);
}
}
}

Expand Down Expand Up @@ -451,6 +442,19 @@ var runtimeRequiredByDeployment
ImplicitPackageReferences = implicitPackageReferences.ToArray();
}

// Determine the known runtime identifier platforms based on all available Microsoft.NETCore.App packs
HashSet<string> knownRuntimeIdentifierPlatforms = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var netCoreAppPacks = knownRuntimePacksForTargetFramework.Where(krp => krp.Name.Equals("Microsoft.NETCore.App", StringComparison.OrdinalIgnoreCase));
foreach (KnownRuntimePack netCoreAppPack in netCoreAppPacks)
{
foreach (var runtimeIdentifier in netCoreAppPack.RuntimePackRuntimeIdentifiers.Split(';'))
{
int separator = runtimeIdentifier.LastIndexOf('-');
string platform = separator < 0 ? runtimeIdentifier : runtimeIdentifier.Substring(0, separator);
knownRuntimeIdentifierPlatforms.Add(platform);
}
}

if (knownRuntimeIdentifierPlatforms.Count > 0)
{
KnownRuntimeIdentifierPlatforms = knownRuntimeIdentifierPlatforms.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ public void It_builds_the_project_successfully_with_only_reference_assembly_set(
// Non-portable and portable RIDs should warn
[InlineData(ToolsetInfo.CurrentTargetFramework, new[] { "ubuntu.22.04-x64", "win7-x86", "unix" }, true, true, null, true)]
// Portable RIDs only should not warn
[InlineData(ToolsetInfo.CurrentTargetFramework, new[] { "win-x86", "linux", "linux-musl-x64", "osx-arm64", "unix" }, true, true, null, false)]
[InlineData(ToolsetInfo.CurrentTargetFramework, new[] { "win-x86", "win", "linux", "linux-musl-x64", "osx", "osx-arm64", "unix", "browser", "browser-wasm", "ios-arm64" }, true, true, null, false)]
// No RID assets should not warn
[InlineData(ToolsetInfo.CurrentTargetFramework, new string[] { }, false, false, null, false)]
// Below .NET 8 should not warn
Expand Down