FSharp.Core: Failed to load file or assembly

When I try to run the test, I get the following error:

{System.IO.FileLoadException: Unable to load file or assembly 'FSharp.Core, Version = 3.3.1.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' or one of its dependencies. The installed assembly manifest definition does not match the Help assembly. (Exception from HRESULT: 0x80131040) File name: 'FSharp.Core, Version = 3.3.1.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' at Register.RegisterResponse .__ DebugDisplay ()

Tests.dll

FSharp.Core: 3.1.2.5

Target F # runtime: 4.3.1.0

Target structure: 4.6

Output Type: Class Library

ManageAccount.dll

FSharp.Core: 3.1.2.5

F # Startup Time: 3.3.1.0

Target structure: .NET Portable Subset (.Net Framework 4.5, ASP.Net Core 1.0, Windows 8)

Output Type: Class Library

Then I added the following application configuration to the test project:

<?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="3.1.2.5" newVersion="3.3.1.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

If I really need application configuration, what value should be set for the bindingRedirect parameter?

+1
source share
2 answers

Try <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.1.0" /> . This is what most F # projects seem to do for FSharp.Core. (Or newVersion="4.3.1.0" or even newVersion="4.4.0.0" if you switch to the new FSharp.Core).

+5
source

In this case, you should use the latest version ( 4.3.1.0 ) in bindingRedirect/newVersion , otherwise you will probably get errors from the code in the Tests.dll assembly, which will rely on the newer version.

Alternatively, you can update the link in one of the assemblies (lower Tests.dll or update ManageAccount.dll ) so that both of them use the same version.

+1
source

Source: https://habr.com/ru/post/1014348/


All Articles