【问题标题】:Using a custom version of FSharp.Core.dll使用自定义版本的 FSharp.Core.dll
【发布时间】:2013-02-09 21:43:08
【问题描述】:

我一直在研究 fsharp 编译器源代码以尝试构建 FSharp.Core (FSharp.Core for Windows Phone 7.1 and F# 3.0) 的 wp7 版本,但有一次我放弃并开始尝试使可移植版本与 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 版本。有人从源代码成功构建了便携式版本吗?

【问题讨论】:

标签: f# mono portable-class-library


【解决方案1】:

你可以做的是添加:

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

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

【讨论】:

  • 我已为 mscorlib、System 和 System.Core 添加了该功能,但仍有问题。最新的是A reference to the type 'System.Collections.Concurrent.Partitioner'1' in assembly 'mscorlib' was found, but the type could not be found in that assembly,但我在任何地方都找不到参考
  • TPL 中的 Array.Parallel 内容
  • 我见过的唯一一个类似的是:FX_NO_CONCURRENT_DICTIONARY。这在 QueryExtensions.fs 和 FX_NO_TPL_PARALLEL 中使用,在 Async 和 Array 定义中。
  • 这是在您的 Fsharp.Data 构建中吗?你有一个失败的回购吗?
  • 如果您尝试在 windows phone 7 项目上使用 FSharp.Data 的便携式库构建,它将无法运行并抱怨 IStructuralEquatable。但我只是想从 fsharp.core 源代码编译 Profile88 并在一个空白的 windowsphone 项目上尝试它。我会把repo放到github上告诉你
【解决方案2】:

经过几次更改https://github.com/ovatsus/fsharp

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-23
    • 2020-08-30
    • 2011-12-09
    • 1970-01-01
    相关资源
    最近更新 更多