2

我有一个 msbuild,我用它来构建一个用于 nuget 分发的项目。它构建了我的程序集的 .net 3.5、.net 4.0 和 .net 4.5 目标版本,以便于打包。在 Windows 上,这一直很好用,但现在我使用 xbuild 在单声道上,除了 .NET 3.5 目标构建之外,一切正常。

我收到一个错误,例如

/Users/akropp/Projects/code/ParsecClone/combinator.msbuild.proj (default targets) ->
(Build target) ->
/Users/akropp/Projects/code/ParsecClone/Combinator/Combinator.fsproj (default targets) ->
/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/4.0/Microsoft.FSharp.Targets (CoreCompile target) ->

    : error FS0219: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library '/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/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 FS0218: Unable to read assembly '/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.dll'

     0 Warning(s)
     2 Error(s)

不确定我缺少什么,因为该程序集对于所有其他目标都是可读的。

可以肯定的是,该文件确实存在

>ls /Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.*
-rwxr-xr-x  1 root  admin  1104896 Nov 14 15:14 /Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.dll*
-rwxr-xr-x  1 root  admin   353617 Nov 14 15:18 /Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.optdata*
-rwxr-xr-x  1 root  admin   488574 Nov 14 15:18 /Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.sigdata*
-rwxr-xr-x  1 root  admin   592077 Nov 14 15:18 /Library/Frameworks/Mono.framework/Versions/3.2.5/lib/mono/gac/FSharp.Core/4.3.0.0__b03f5f7f11d50a3a/FSharp.Core.xml*

--

编辑:

有趣的是,我实际上在 Xamarin Studio 中将我的项目定位到 .NET 3.5 时遇到了同样的错误。我不确定这是否是一个错误,或者是否有其他东西发生了变化,这不应该首先起作用。

4

1 回答 1

2

IIRC 最新版本的开源 F# 编译器(托管在 github 上的编译器)默认为 .NET 4.0。您需要自己编译 F# 来调整构建以允许它安装必要的 .NET 3.5 位。

于 2013-12-19T11:04:21.920 回答