knocte
knocte

Reputation: 17919

4.6.1 F# app throwing FileNotFoundException: FSharp.Core

I have a .NET4.6.1 project which, if I link to Nuget's FSharp.Core latest version (at the time of writing 4.3.4) throws the following exception:

Can't find custom attr constructor image: /Users/andres/Documents/Code/MyApp/src/MyApp/bin/Debug/MyApp.exe mtoken: 0x0a000015 due to: Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type: member:

Strangely enough, I only find the .dll in the obj folder but not in the bin one, after compiling:

$ find ./src | grep FSharp.Core
./src/MyApp/obj/Debug/FSharp.Core.dll

Is this expected? I'm using VS4Mac.

Upvotes: 2

Views: 262

Answers (1)

knocte
knocte

Reputation: 17919

Turns out that, when upgrading FSharp.Core nuget dependency to the new version, the real diff that was happening in the .fsproj file was this:

     <Reference Include="FSharp.Core">
-      <HintPath>..\..\packages\FSharp.Core.4.1.0.2\lib\net45\FSharp.Core.dll</HintPath>
+      <HintPath>..\..\packages\FSharp.Core.4.3.4\lib\net45\FSharp.Core.dll</HintPath>
+      <Private>False</Private>
     </Reference>

(But seeing this was not clear because it was moving the <Reference> tag somewhere else in the file.)

Note the addition of the <Private> tag above. If you do what is advised in this other answer to a similar question (which I'll not claim is a duplicate because that one is regarding Windows and this one is macOS), that is, marking the reference as LocalCopy=true, then Visual Studio removes the <Private>False</Private> XML element, and everything starts to work again.

Upvotes: 2

Related Questions