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

2023-12-29

我一直在研究 fsharp 编译器源代码,尝试构建 FSharp.Core 的 wp7 版本(适用于 Windows Phone 7.1 和 F# 3.0 的 FSharp.Core https://stackoverflow.com/questions/14694577/fsharp-core-for-windows-phone-7-1-and-f-3-0),有一次我放弃了,开始尝试让便携式版本与 wp7 一起使用。我添加了FX_NO_STRUCTURAL_EQUALITY定义为portable-net4+sl4+wp71+win8目标框架,这似乎导致它在运行时无法工作,并尝试替换中的 FSharp.Core.dllC:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\.NETPortable与我的自定义版本。但在 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>

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 FSharp.Core.dll 的自定义版本 的相关文章

随机推荐