f# - 使用自定义版本的 FSharp.Core.dll

标签 f# mono portable-class-library

我一直在研究 fsharp 编译器源代码,试图构建一个 wp7 版本的 FSharp.Core ( FSharp.Core for Windows Phone 7.1 and F# 3.0 ),有一次我放弃了,开始尝试让可移植版本与 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依赖于可移植的2.0.5.0版本的mscorlib.dll、System.dll和System.Core.dll这些程序集,而我从源码编译的依赖于不可移植的 4.0.0.0 版本。有没有人从源代码成功构建了便携版本?

最佳答案

你可以做的是添加:

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

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

关于f# - 使用自定义版本的 FSharp.Core.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14791925/

相关文章:

c# - Object.ReferenceEquals 为匹配的字符串返回 true

linux - CentOS 6 .slm 构建编译错误(SteamBoat)

将时间从 UTC 转换为指定的时区时出现 .NET PCL 异常

F# 将序列拆分为每个第 n 个元素的子列表

sharepoint - F# 脚本 SharePoint 2010 API 不起作用

algorithm - 在线性时间内找到两个排序列表中的公共(public)元素

.net - 使用类型提供程序而不是 t4 有什么好处吗?

c# - 用于 Linux 发行版的 MonoDevelop 5.0?

c# - 我可以在标准 .Net 应用程序中使用 PCL 库吗?

c# - PCL 中的 TPL 和监视器