简体   繁体   中英

[F#]; [Compilation error]; Cannot compile any F# program

I just started programming in F# (using Visual Studio 2017 on windows 10) and I can't compile any F# program I try to write.

I created a console application and wrote some code but got stuck immediately as the compilation failed:

open System
printf "hello world"
Console.ReadKey() |> ignore

And here's what i got:

Error FS0193 The module/namespace 'System.Collections.Generic' from compilation unit 'mscorlib' did not contain the namespace, module or type 'IReadOnlyCollection`1'


I also tried a simpler version:

printf "Hey"

And got that:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.


I tried to repair Visual Studio through the Visual Studio Installer but it did not help.

我通过删除对mscorlib引用并重建(VS2017)解决了此问题

我刚刚创建了一个全新的解决方案,它的运行效果非常好……我仍然不知道问题出在什么地方……

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM