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

FSI and FSC default to at most .NET Framework 4.6.1, missing .NET 4.6.2/4.7/4.7.1/4.7.2 #4946

Closed
dsyme opened this issue May 18, 2018 · 12 comments · Fixed by #6005
Closed

FSI and FSC default to at most .NET Framework 4.6.1, missing .NET 4.6.2/4.7/4.7.1/4.7.2 #4946

dsyme opened this issue May 18, 2018 · 12 comments · Fixed by #6005

Comments

@dsyme
Copy link
Contributor

dsyme commented May 18, 2018

  • FSI.EXE doesn't detect the presence of .NET Framework 4.6.2/4.7/4.7.1/4.7.2 and uses 4.6.1 as latest by default
  • FSC.EXE likewise when run from the command line e.g. fsc foo.fs (and thus no --noframework flag is given)
@cartermp
Copy link
Contributor

@dsyme are the targeting packs for these installed on your machine?

@dsyme
Copy link
Contributor Author

dsyme commented May 18, 2018

No they aren't you're right.

@dsyme
Copy link
Contributor Author

dsyme commented May 18, 2018

Still we need to detect them to make F# Interactive pick them up, see PR #4947

@cartermp
Copy link
Contributor

Makes sense. Can you update the issue?

@dsyme dsyme changed the title Allow creation of .NET 4.6.2/4.7/4.7.1/4.7.2 projects FSI and FSC default to at most .NET FRamework 4.6.1, mising .NET 4.6.2/4.7/4.7.1/4.7.2 May 18, 2018
@dsyme dsyme changed the title FSI and FSC default to at most .NET FRamework 4.6.1, mising .NET 4.6.2/4.7/4.7.1/4.7.2 FSI and FSC default to at most .NET Framework 4.6.1, mising .NET 4.6.2/4.7/4.7.1/4.7.2 May 18, 2018
@dsyme
Copy link
Contributor Author

dsyme commented May 18, 2018

Updated.

@realvictorprm
Copy link
Contributor

(@dsyme there's a small typo in the title mising instead of missing)

@cartermp cartermp changed the title FSI and FSC default to at most .NET Framework 4.6.1, mising .NET 4.6.2/4.7/4.7.1/4.7.2 FSI and FSC default to at most .NET Framework 4.6.1, missing .NET 4.6.2/4.7/4.7.1/4.7.2 Jul 21, 2018
@cartermp cartermp added this to the 16.0 milestone Jul 22, 2018
@cartermp
Copy link
Contributor

@dsyme Should this also be a consideration for the FSI/.NET Core plan (that I swear I'll encode in the RFC soon...)?

@cartermp
Copy link
Contributor

cartermp commented Dec 1, 2018

@KevinRansom @dsyme we should get this worked out, at least for FSC, but January.

@KevinRansom
Copy link
Member

@dsyme,

I am assuming you are discussing the behaviour of the command line tool, rather than the behaviour of the compiler under the tooling, specifically the behavior of referencing a framework assembly without specifying the path to the assembly being referenced.

For VS 2019 RTM will have a dependence on .NET 472 and so we will update FSI and FSC for the desktop to prefer net472, and fall back through the others.

However, developers should use NetSDK projects for the fsc compiler and nuget packages for Fsi dependencies. Relying on this hunting about resolution needs to be discouraged.

Kevin

@dsyme
Copy link
Contributor Author

dsyme commented Dec 2, 2018

@KevinRansom Yes, and thus also the default assemblies referenced (eg System, mscorlib) when you start fsi.exe

@psantoro
Copy link

psantoro commented Dec 4, 2018

My first attempt to use the --noframework flag was unsuccessful (issue #5964). I believe the documentation for the F# advanced compiler options leaves out some details, so here's my feedback.

The attached sample project targets .NET 4.7.2 and seems to work. It uses a makefile and is built with nmake on Windows. This sample may help others who are trying to use a version of .NET not yet included in FSC's built-in resolution logic. If time permits, I would appreciate it if someone can review it and let me know if I've missed anything.

In general, I believe this issue can be categorized as a mode error (see chapter 11 of BEHIND HUMAN ERROR 2nd Edition). In this case, the F# compiler (by default) is using a built-in mode to resolve the .NET assemblies to be used when the project is compiled/run, but fails to make this fact observable to the user.

Perhaps the F# compiler should output this information to stdout to make this fact observable, when the --nologo option is not used or when a new --verbose flag is used? This output could include the target .net version chosen and/or the full path of each implicitly used DLL. This information may prove useful for debugging build issues going forward.

As documented, the F# compiler --noframework flag runs the compiler in a different mode (i.e. FSC default CLI assemblies aren't used). It appears that in the --noframework mode the --lib flag is ignored for mscorlib.dll and FSharp.Core.dll. Given that these 2 DLLs are critical to the build process, this is understandable.

It is also unclear what the --simpleresolution flag actually does from the documentation. From my testing, this flag appears to support searching for references using the paths found via other references and those included in the --lib flag (instead of using the built-in MSBuild resolution). I'm guessing that it might not always be safe to use the --noframework flag without using the --simpleresolution flag. If so, then perhaps the compiler should throw a warning or error in this case?

hashset472.zip

Peter

@KevinRansom
Copy link
Member

KevinRansom commented Dec 4, 2018 via email

KevinRansom added a commit to KevinRansom/fsharp that referenced this issue Dec 13, 2018
KevinRansom added a commit to KevinRansom/fsharp that referenced this issue Dec 13, 2018
KevinRansom added a commit to KevinRansom/fsharp that referenced this issue Dec 13, 2018
brettfo pushed a commit that referenced this issue Dec 14, 2018
…#6005)

* Fix #4946  --- Update FSC and FSI to recognize upto .net framework 472

* support really old frameworks

* Update test to satisfy net472 as well as earlier versions of dotnet

* comparer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants