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/monoand 2.10.9 in/Library/Frameworks/Mono.framework. Thefsicommand was symlink to thefsi.exethat shipped with the latter, while themonocommand itself was another symlink pointing to the former.Lesson learned: Make sure you don’t have two versions of the same software installed