System.IO.FileLoadException (Updating Foq to 1.4)


When I updated Foq to 1.4 I got the following exception:
System.IO.FileLoadException : Could not load file or assembly 'FSharp.Core, Version=, 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)
Closed Jan 26, 2014 at 6:32 PM by ptrelford


ptrelford wrote Dec 3, 2013 at 10:29 PM

Sorry, the packaging of Foq 1.4 might have been slightly different to Foq 1.3.
The .Net 4.0 version of Foq 1.4 was built with Studio 2010 which binds to FSharp.Core, if you are building using Visual Studio 2012/2013 then by default it binds to FSharp.Core. The .Net 4.5 assembly was built with Visual Studio 2012 so should not be an issue.
Nuget should automatically add binding redirects, but if it hasn't you can manually resolve the issue by can adding bindingRedirect elements to your app.config: https://foq.codeplex.com/SourceControl/latest#Examples/App.config

baxevanis wrote Dec 4, 2013 at 9:01 AM

Nice! Adding a binding redirect in the app.config solved the problem.

Indeed, NuGet Package Manager should automatically do this... (If this is not the case, it might scare users who are updating to 1.4.)

Thanks for helping!