Link to x64 dll file works in C #, but does not work in F #

I created two new solutions using the latest VS 2010:

  • c # console application
  • console application F #

I refer to two x64 dll files: Kitware.VTK.dll and Kitware.mummy.Runtime.dll
(can be downloaded here: http://www.kitware.com/products/avdownload.php )

C # VS 2010 finds a namespace when I write using Kitware .
F # VS 2010 does not find the namespace when I write open Kitware .

The x86 version works fine in F #. Any idea why this is and how to get Kitware x64 working in F #?

+3
source share
3 answers

Probably due to the error described here:

Links to F # projects do not work when configuring the x64 platform in Visual Studio 2010

They say that it will be fixed in the next version of VS.

good -h -

+1
source

F # console applications default to x86 targeting, not any CPU. If you have not changed this, the F # project will not work with the x64 library.

0
source

I think I can fix it. This requires manually editing the fsproj file.

Add this after the <PropertyGroup> elements and before the 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> 

Please note that OtherFlags rewritten, which was fine for me since it was empty. If it is used, most likely you should add to the variable. It would be nice to use Microsoft.Build.Tasks for a list of paths instead of using a hard-coded list, but I could not get this to work.

0
source

All Articles