From f25594bd520f678abcf1188dc12e9756dedb9cf4 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 11 Feb 2026 16:10:43 +0300 Subject: [PATCH 1/3] wip --- src/Compiler/Driver/FxResolver.fs | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index f9d39d3ba53..eb4c4cae48c 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -260,13 +260,28 @@ type internal FxResolver let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings" - // Use the FSharp.Core that is executing with the compiler as a backup reference - let getFSharpCoreImplementationReference () = - Path.Combine(getFSharpCompilerLocation (), getFSharpCoreLibraryName + ".dll") + let getFSharpLibImplementationReferences useFsiAuxLib = + let getFSharpLibImplementationReference libName = + // Use the FSharp.Core/FSharp.Compiler.Interactive.Settings + // that is executing with the compiler as a backup reference + let getDefaultImplementationReference libName = + Path.Combine(getFSharpCompilerLocation (), libName + ".dll") + + match sdkDirOverride with + | None -> getDefaultImplementationReference libName + | Some sdkDirOverride -> + let libPath = Path.Combine(sdkDirOverride, "FSharp", libName + ".dll") + + if File.Exists(libPath) then + libPath + else + getDefaultImplementationReference libName - // Use the FSharp.Compiler.Interactive.Settings executing with the compiler as a backup reference - let getFsiLibraryImplementationReference () = - Path.Combine(getFSharpCompilerLocation (), getFsiLibraryName + ".dll") + [ + getFSharpLibImplementationReference getFSharpCoreLibraryName + if useFsiAuxLib then + getFSharpLibImplementationReference getFsiLibraryName + ] // Use the ValueTuple that is executing with the compiler if it is from System.ValueTuple // or the System.ValueTuple.dll that sits alongside the compiler. (Note we always ship one with the compiler) @@ -615,9 +630,7 @@ type internal FxResolver let roots = [ yield! Directory.GetFiles(implDir, "*.dll") - getFSharpCoreImplementationReference () - if useFsiAuxLib then - getFsiLibraryImplementationReference () + yield! getFSharpLibImplementationReferences useFsiAuxLib ] (getDependenciesOf roots).Values |> Seq.toList @@ -928,9 +941,7 @@ type internal FxResolver let sdkReferences = [ yield! Directory.GetFiles(path, "*.dll") - getFSharpCoreImplementationReference () - if useFsiAuxLib then - getFsiLibraryImplementationReference () + yield! getFSharpLibImplementationReferences useFsiAuxLib ] |> List.filter (Path.GetFileNameWithoutExtension >> (!!) >> systemAssemblies.Contains) From f1ab7d416339e09fe1bebe836b052ee86c188533 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 11 Feb 2026 17:26:37 +0300 Subject: [PATCH 2/3] wip --- src/Compiler/Driver/FxResolver.fs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Compiler/Driver/FxResolver.fs b/src/Compiler/Driver/FxResolver.fs index eb4c4cae48c..8c3cbd5edcc 100644 --- a/src/Compiler/Driver/FxResolver.fs +++ b/src/Compiler/Driver/FxResolver.fs @@ -256,10 +256,6 @@ type internal FxResolver let getImplementationAssemblyDir () = implementationAssemblyDir.Force() - let getFSharpCoreLibraryName = "FSharp.Core" - - let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings" - let getFSharpLibImplementationReferences useFsiAuxLib = let getFSharpLibImplementationReference libName = // Use the FSharp.Core/FSharp.Compiler.Interactive.Settings @@ -280,7 +276,7 @@ type internal FxResolver [ getFSharpLibImplementationReference getFSharpCoreLibraryName if useFsiAuxLib then - getFSharpLibImplementationReference getFsiLibraryName + getFSharpLibImplementationReference fsiLibraryName ] // Use the ValueTuple that is executing with the compiler if it is from System.ValueTuple From 4fd254d4c944ecb004e4d151230e807c0c1a4530 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 11 Feb 2026 19:56:56 +0300 Subject: [PATCH 3/3] release notes --- docs/release-notes/.FSharp.Compiler.Service/10.0.300.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md index c247da5870b..92f2be7e805 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md @@ -1,5 +1,7 @@ ### Fixed +* F# Scripts: Fix default reference paths resolving when an SDK directory is specified. ([PR #19270](https://github.com/dotnet/fsharp/pull/19270)) + ### Added ### Changed