我一直在与fsharp编译器的源代码闲逛试图 Build FSharp.Core(FSharp.Core for Windows Phone 7.1 and F# 3.0)的WP7版本,在一个点上,我放弃了,并开始试图与WP7便携版工作,而不是 . 我将 FX_NO_STRUCTURAL_EQUALITY
define添加到 portable-net4+sl4+wp71+win8
目标框架中,这似乎是导致它在运行时无法工作的原因,并试图用我的自定义版本替换 C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\.NETPortable
中的FSharp.Core.dll . 但是在Visual Studio中编译时出现此错误:
Warning 1 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
Warning 3 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
Warning 2 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
问题是VS2012附带的便携式FSharp.Core依赖于mscorlib.dll,System.dll和System.Core.dll这些程序集的便携式2.0.5.0版本,但我从源代码编译的那个依赖于非便携式4.0.0.0版本 . 有没有人从源代码成功构建了便携版本?
2 回答
你可以做的是添加:
<OtherFlags>$(OtherFlags) --simpleresolution -r:"pathToTheCorrectmscorlib/mscorlib-runtime.dll" </OtherFlags>
到
FSharp.Source.Targets
文件 . 在<DefineConstants>
元素之后执行此正确的文件 . 这应该导致编译阶段使用您指定的mscorlib
版本,而不是msbuild目标指定的默认版本 . (显然用正确的替换pathToTheCorrectmscorlib/mscorlib-runtime.dll
:))在经历了几次更改之后,将f4内的portable-net4 sl4 wp71 win8目标编译成了Profile88 https://github.com/ovatsus/fsharp
但仍需要在运行时彻底测试