'Could not load file or assembly 'FSharp.Core, Version=4.6.2.0

4

I upgraded Visual Studio from VS2017 to VS2019. I opened a solution with both C# and F# in it. A C# unit test project references a F# .dll project.

The solution compiles fine but at run time, I get the following message

System.IO.FileLoadException: 'Could not load file or assembly 'FSharp.Core, Version=4.6.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

and the inner exception is

Could not load file or assembly 'FSharp.Core, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have this in the unit tests app.config:

  <dependentAssembly>
    <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.2.0" />
  </dependentAssembly>

and the unit test project has this in the packages.config

<package id="FSharp.Core" version="4.6.2" targetFramework="net461" />

Is there a missing reference I am not seeing?

Thanks

visual-studio
f#
asked on Stack Overflow May 27, 2019 by Jamie Dixon

1 Answer

4

Bent Tranberg was right

In the test project, I changed the binding redirect to

       <dependentAssembly>
         <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-4.6.2.0" newVersion="4.6.0.0" />
       </dependentAssembly>

and it worked

answered on Stack Overflow May 27, 2019 by Jamie Dixon

User contributions licensed under CC BY-SA 3.0