[英]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.