From 603176a0fa3d4949bd1be489366d7766b5968ce0 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 2 Feb 2021 10:16:50 -0800 Subject: [PATCH] net5.0 (#10992) --- src/fsharp/FxResolver.fs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/fsharp/FxResolver.fs b/src/fsharp/FxResolver.fs index 665f142b4d0..31e8307c2fb 100644 --- a/src/fsharp/FxResolver.fs +++ b/src/fsharp/FxResolver.fs @@ -295,7 +295,6 @@ type internal FxResolver(assumeDotNetFramework: bool option, projectDir: string, let startPos = let startPos = file.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) if startPos >= 0 then startPos + (pattern.Length) else startPos - let length = if startPos >= 0 then let ep = file.IndexOf("\"", startPos) @@ -305,16 +304,21 @@ type internal FxResolver(assumeDotNetFramework: bool option, projectDir: string, | -1, _ | _, -1 -> if isRunningOnCoreClr then - // Running on coreclr but no deps.json was deployed with the host so default to 3.1 - Some "netcoreapp3.1" + // Running on coreclr but no deps.json was deployed with the host so default to 5.0 + Some "net5.0" else // Running on desktop None | pos, length -> // use value from the deps.json file - Some ("netcoreapp" + file.Substring(pos, length)) - - // Tries to figure out the tfm for the compiler instance on the Windows desktop. + let suffix = file.Substring(pos, length) + let prefix = + match Double.TryParse(suffix) with + | true, value when value < 5.0 -> "netcoreapp" + | _ -> "net" + Some (prefix + suffix) + + // Tries to figure out the tfm for the compiler instance on the Windows desktop // On full clr it uses the mscorlib version number let getRunningDotNetFrameworkTfm () = let defaultMscorlibVersion = 4,8,3815,0