Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix net sdk references discovery #10569

Merged
merged 3 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be a semver comparison, but that gets nasty so I suppose this is good enough.

Could you check this, though, with a purposely badly named runtime dir name? I commonly pretend to remove, e.g., the 3.1.2 dir by renaming it to brettfo_3.1.2.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes numbers are better than string comparisons. I will change it.

|> Array.filter(fun di -> di.Name <= version)
|> Array.last
Some (directory.Name), Some microsoftNETCoreAppRef
else
Some version, None
with | _ -> None, None
Expand Down