Skip to content

Commit

Permalink
Fix net sdk references discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Nov 30, 2020
1 parent 7e46237 commit 8b8da8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/fsharp/CompilerConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,6 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
#endif
None, data.legacyReferenceResolver.HighestInstalledNetFrameworkVersion()

let systemAssemblies = systemAssemblies

member x.primaryAssembly = data.primaryAssembly
member x.noFeedback = data.noFeedback
member x.stackReserveSize = data.stackReserveSize
Expand Down
9 changes: 7 additions & 2 deletions src/fsharp/DotNetFrameworkDependencies.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
// packs\Microsoft.NETCore.App.Ref\sdk-version\netcoreappn.n
// we will rely on the sdk-version match on the two paths to ensure that we get the product that ships with the
// version of the runtime we are executing on
// Use the reference assemblies for the highest netcoreapp tfm that we find in that location.
// Use the reference assemblies for the highest netcoreapp tfm that we find in that location that is
// lower than or equal to the implementation version.
let version, frameworkRefsPackDirectoryRoot =
try
let version = DirectoryInfo(implementationAssemblyDir).Name
let microsoftNETCoreAppRef = Path.Combine(implementationAssemblyDir, "../../../packs/Microsoft.NETCore.App.Ref")
if Directory.Exists(microsoftNETCoreAppRef) then
Some version, Some microsoftNETCoreAppRef
let directory = DirectoryInfo(microsoftNETCoreAppRef).GetDirectories()
|> Array.sortBy (fun di -> di.Name)
|> Array.filter(fun di -> di.Name <= version)
|> Array.last
Some (directory.Name), Some microsoftNETCoreAppRef
else
Some version, None
with | _ -> None, None
Expand Down

0 comments on commit 8b8da8d

Please sign in to comment.