File tree Expand file tree Collapse file tree
src/Cli/dotnet/ToolPackage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,15 @@ protected ToolPackageDownloaderBase(
5757 _currentWorkingDirectory = currentWorkingDirectory ;
5858
5959 _localToolAssetDir = new DirectoryPath ( _fileSystem . Directory . CreateTemporarySubdirectory ( ) ) ;
60- _runtimeJsonPath = runtimeJsonPathForTests ?? Path . Combine ( AppContext . BaseDirectory ! , "RuntimeIdentifierGraph.json" ) ;
60+
61+ // Tools target modern (net8.0+) frameworks, for which the SDK resolves RIDs using the simplified
62+ // "portable" RID graph by default (UseRidGraph=false). Prefer that graph here so tool RID-asset
63+ // selection matches normal restore/build; fall back to the legacy graph if the portable one isn't
64+ // present in the layout.
65+ string portableRuntimeJsonPath = Path . Combine ( AppContext . BaseDirectory ! , "PortableRuntimeIdentifierGraph.json" ) ;
66+ string legacyRuntimeJsonPath = Path . Combine ( AppContext . BaseDirectory ! , "RuntimeIdentifierGraph.json" ) ;
67+ _runtimeJsonPath = runtimeJsonPathForTests
68+ ?? ( File . Exists ( portableRuntimeJsonPath ) ? portableRuntimeJsonPath : legacyRuntimeJsonPath ) ;
6169 }
6270
6371 protected abstract INuGetPackageDownloader CreateNuGetPackageDownloader (
You can’t perform that action at this time.
0 commit comments