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
bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.6.0.0"
in spite of all projects in my solution using FSharp.Core 4.6.2.0. I'm using NUnit. Can you try changing the redirect to 4.6.0.0 in your unit test project and see if it helps? I suspect I got that same inner exception, and eventually arrived at this veird solution. – Bent Tranberg