基地CLI库“mscorlib程序”是与引用的F#核心库二进制兼容核心、基地、程序、mscorlib

2023-09-04 10:23:11 作者:一身痞味儿

我已经建立了一个网站,花费code段和编译它们并运行它们。然而,F#是在服务器上破。每当我尝试编译F#code我收到以下错误信息:

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:

的引用或默认基CLI库mscorlib程序是与引用的F#核心库二进制兼容C:\ Program Files文件(x86)的\微软F#\ V4.0 \ FSharp.Core.dll。考虑重新编译库或作出明确提到一个版本库匹配您正在使用的命令行版本。

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.

C:\ Program Files文件(x86)的\微软F#\ V4.0 \ FSharp.Core.dll:错误打开二进制文件。类型的异常Microsoft.FSharp.Compiler.ErrorLogger + ReportedError被扔

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.

需要明确的是,这是由编译器,而不是code运行时发生的错误返回一个错误。

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

该网站运行得很好我的开发机器和工作得很好VM上我纺,以帮助诊断问题。

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

只有谷歌打的错误信息导致我尝试清理F#/。NET安装无济于事。我做了修复安装的框架和卸载/重新安装我使用的是F#的包。

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.

例如:http://dotnetpad.net/ViewPaste/ZvXBgizf70q83Fk6VmboHw

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

推荐答案

什么是命令行要传递到fsc.exe在服务器上?它闻起来像你是 -r -ing FSharp.Core 4.0,但mscorlib程序2.0。一定要在命令行中传递明确提及两者。检查输出窗口在Visual Studio中,当你建立了一个示例命令行。

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.

修改

看到这一问题:

FSharp.Compiler.$c$cDom为VS2008和VS2010并排侧