3

我使用最新的 VS 2010 创建了两个全新的解决方案:

  • C# 控制台应用程序
  • F# 控制台应用程序

我引用了两个 x64 dll 文件:Kitware.VTK.dllKitware.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# 中工作吗?

4

3 回答 3

1

这可能是由于这里描述的错误:

在 Visual Studio 2010 中以 x64 平台为目标时,F# 项目引用不起作用

他们说它将在 VS 的下一个版本中修复。

好好的-h-

于 2011-07-12T11:39:45.187 回答
0

F# 控制台应用程序默认以 x86 而非任何 CPU 为目标。如果您没有更改它,那么 F# 项目将无法使用 x64 库。

于 2011-07-12T15:31:28.223 回答
0

我想我可能有一个解决办法。它需要手动编辑您的 fsproj 文件。

<PropertyGroup>在items之后和 first 之前添加这个<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它已被覆盖,这对我来说没问题,因为它是空的。如果使用它,您可能应该追加到变量中。使用路径列表而不是使用硬编码列表会很好Microsoft.Build.Tasks,但我无法让它工作。

于 2012-12-03T14:13:23.020 回答