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

Conversation

KevinRansom
Copy link
Member

The original algorithm for mapping NETSdk pack locations from the implementation directoy was incorrect.

We now compute the NETSdk reference assembly to be the highest version that is lower 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.

@KevinRansom KevinRansom merged commit cd0d9f2 into dotnet:main Dec 1, 2020
laenas pushed a commit to laenas/fsharp that referenced this pull request Dec 1, 2020
* Fix net sdk references discovery

* Do numbers properly

* version filter
laenas pushed a commit to laenas/fsharp that referenced this pull request Dec 1, 2020
* Fix net sdk references discovery

* Do numbers properly

* version filter
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Fix net sdk references discovery

* Do numbers properly

* version filter
@KevinRansom KevinRansom deleted the fixsdk branch January 21, 2022 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants