From 5879f1baf1bb3ad0cd78de4c3e5ead5c442971ff Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:24:51 +0300 Subject: [PATCH 1/2] Use PortableRuntimeIdentifierGraph in ToolPackage --- .../dotnet/ToolPackage/ToolPackageDownloaderBase.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs b/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs index cacfcc3157a2..a1a2039533bc 100644 --- a/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs +++ b/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs @@ -57,7 +57,15 @@ protected ToolPackageDownloaderBase( _currentWorkingDirectory = currentWorkingDirectory; _localToolAssetDir = new DirectoryPath(_fileSystem.Directory.CreateTemporarySubdirectory()); - _runtimeJsonPath = runtimeJsonPathForTests ?? Path.Combine(AppContext.BaseDirectory!, "RuntimeIdentifierGraph.json"); + + // Tools target modern (net8.0+) frameworks, for which the SDK resolves RIDs using the simplified + // "portable" RID graph by default (UseRidGraph=false). Prefer that graph here so tool RID-asset + // selection matches normal restore/build; fall back to the legacy graph if the portable one isn't + // present in the layout. + string portableRuntimeJsonPath = Path.Combine(AppContext.BaseDirectory!, "PortableRuntimeIdentifierGraph.json"); + string legacyRuntimeJsonPath = Path.Combine(AppContext.BaseDirectory!, "RuntimeIdentifierGraph.json"); + _runtimeJsonPath = runtimeJsonPathForTests + ?? (File.Exists(portableRuntimeJsonPath) ? portableRuntimeJsonPath : legacyRuntimeJsonPath); } protected abstract INuGetPackageDownloader CreateNuGetPackageDownloader( From 0112da8bde5f97e9ea5d28608c5def682eb67bf2 Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Sun, 28 Jun 2026 17:25:29 +0300 Subject: [PATCH 2/2] Address CR feedback --- .../dotnet/ToolPackage/ToolPackageDownloaderBase.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs b/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs index a1a2039533bc..8009102003c3 100644 --- a/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs +++ b/src/Cli/dotnet/ToolPackage/ToolPackageDownloaderBase.cs @@ -57,15 +57,7 @@ protected ToolPackageDownloaderBase( _currentWorkingDirectory = currentWorkingDirectory; _localToolAssetDir = new DirectoryPath(_fileSystem.Directory.CreateTemporarySubdirectory()); - - // Tools target modern (net8.0+) frameworks, for which the SDK resolves RIDs using the simplified - // "portable" RID graph by default (UseRidGraph=false). Prefer that graph here so tool RID-asset - // selection matches normal restore/build; fall back to the legacy graph if the portable one isn't - // present in the layout. - string portableRuntimeJsonPath = Path.Combine(AppContext.BaseDirectory!, "PortableRuntimeIdentifierGraph.json"); - string legacyRuntimeJsonPath = Path.Combine(AppContext.BaseDirectory!, "RuntimeIdentifierGraph.json"); - _runtimeJsonPath = runtimeJsonPathForTests - ?? (File.Exists(portableRuntimeJsonPath) ? portableRuntimeJsonPath : legacyRuntimeJsonPath); + _runtimeJsonPath = runtimeJsonPathForTests ?? Path.Combine(AppContext.BaseDirectory!, "PortableRuntimeIdentifierGraph.json"); } protected abstract INuGetPackageDownloader CreateNuGetPackageDownloader(