[英]Referencing an x64 dll file works in C# but does not work in F#
我使用最新的 VS 2010 创建了两个全新的解决方案:
我引用了两个 x64 dll 文件: Kitware.VTK.dll
和Kitware.mummy.Runtime.dll
(可以在这里下载: http://www.kitware.com/products/avdownload.php )
C# VS 2010 在我using Kitware
编写时找到了命名空间。
F# VS 2010 在我编写open Kitware
时找不到命名空间。
x86 版本在 F# 中运行良好。 知道为什么会这样以及如何使 Kitware x64 在 F# 中工作吗?
我想我可能有一个解决办法。 它需要手动编辑您的 fsproj 文件。
在<PropertyGroup>
项之后和第一个<Import>
之前添加它。
<PropertyGroup Condition="'$(Platform)' == 'x64'">
<!--
Assembly resolution using msbuild is broken for the x64 platform in F# 2.0.
See https://connect.microsoft.com/VisualStudio/feedback/details/588317/f-project-references-not-working-when-targeting-x64-platform-in-visual-studio-2010
We use simple resolution with a hard-coded list of paths to look for the dlls instead.
-->
<NoStdLib>true</NoStdLib>
<OtherFlags>--simpleresolution</OtherFlags>
<ReferencePath>C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Windows\Microsoft.NET\Framework64\v2.0.50727</ReferencePath>
</PropertyGroup>
请注意, OtherFlags
已被覆盖,这对我来说没问题,因为它是空的。 如果使用它,您可能应该将 append 改为变量。 最好将Microsoft.Build.Tasks
用于路径列表,而不是使用硬编码列表,但我无法让它工作。
F# 控制台应用程序默认针对 x86 而不是任何 CPU。 如果您没有更改它,那么 F# 项目将无法与 x64 库一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.