I've installed Mono successfully with the mac installer (which includes F#), and have been playing around with the interactive shell. I can also compile F# source files just fine to produce a .NET EXE, but when I try to run it with Mono, I get the error:
Unhandled Exception: System.TypeLoadException: Could not load type '<StartupCode$HelloWorld>.$HelloWorld' from assembly 'HelloWorld, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type '<StartupCode$HelloWorld>.$HelloWorld' from assembly 'HelloWorld, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
The contents of the file — HelloWorld.fs — is simply
printfn "Hello world"
I've also read this question , but the solution does not fix my problem. Any ideas?
Turns out, I had 2 different mono versions installed in two separate locations — 2.10.6 in /opt/local/lib/mono
and 2.10.9 in /Library/Frameworks/Mono.framework
. The fsi
command was symlink to the fsi.exe
that shipped with the latter, while the mono
command itself was another symlink pointing to the former.
Lesson learned: Make sure you don't have two versions of the same software installed
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.