3

我一直在研究 fsharp 编译器源代码以尝试构建 FSharp.Core 的 wp7 版本(适用于 Windows Phone 7.1 和 F# 3.0的 FSharp.Core ),有一次我放弃并开始尝试制作便携式版本与 wp7 一起工作。我将FX_NO_STRUCTURAL_EQUALITY定义添加到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 版本。有没有人从源代码成功构建了便携式版本?

4

2 回答 2

1

你可以做的是添加:

<OtherFlags>$(OtherFlags) --simpleresolution -r:"pathToTheCorrectmscorlib/mscorlib-runtime.dll" </OtherFlags>

FSharp.Source.Targets文件。<DefineConstants>在元素之后执行此正确文件。这应该会导致编译阶段使用mscorlib您指定的版本,而不是 msbuild 目标指定的默认版本。(显然替换pathToTheCorrectmscorlib/mscorlib-runtime.dll为正确的:))

于 2013-02-11T10:57:12.130 回答
1

经过几次更改后,将portable-net4+sl4+wp71+win8目标从F#源编译为Profile88 https://github.com/ovatsus/fsharp

不过,仍然需要在运行时彻底测试

于 2013-02-18T14:27:17.887 回答