019
019

Reputation: 480

[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.

Upvotes: 4

Views: 965

Answers (2)

Andrew Olney
Andrew Olney

Reputation: 741

I solved this by deleting references to mscorlib and rebuilding (VS2017)

Upvotes: 2

019
019

Reputation: 480

I just created a brand new solution and it worked perfectly fine... I still don't know what the problem was though...

Upvotes: 1

Related Questions