Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library

I've built a website that takes code snippets and compiles them and runs them. However, F# is broken on the server. Whenever I try to compile F# code I get the following error message:

The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library 'C:\Program Files (x86)\Microsoft F#\v4.0\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.

Error opening binary file 'C:\Program Files (x86)\Microsoft F#\v4.0\FSharp.Core.dll': Exception of type 'Microsoft.FSharp.Compiler.ErrorLogger+ReportedError' was thrown.

To be clear, this is an error being returned by the compiler, not an error that occurs when the code is run.

The site runs just fine on my development machine and works just fine on a VM I spun up to help diagnose the issue.

The only Google hit for the error message caused me to try cleaning up the F#/.NET install to no avail. I did a repair install of the framework and uninstalled/reinstalled the F# packages I'm using.

Example: http://dotnetpad.net/ViewPaste/ZvXBgizf70q83Fk6VmboHw

F# compilation code: http://bitbucket.org/gobiner/.net-pad/src/tip/DotNetPad/Compilers/FSharpCompiler.cs

like image 397
Gobiner Avatar asked Nov 06 '22 06:11

Gobiner


1 Answers

What is the command-line you are passing to fsc.exe on the server? It smells like you are -r-ing FSharp.Core 4.0 but mscorlib 2.0. Be sure to pass explicit references to both on the command-line. Check the Output Window in Visual Studio when you build for a sample command-line.

EDIT

See this question:

FSharp.Compiler.CodeDom for VS2008 and VS2010 side-by-side

like image 192
Brian Avatar answered Nov 09 '22 04:11

Brian