Why doesn't bindingRedirect affect FSharp.Core version

356 views Asked by At

I have a unit test project that targets F# runtime 4.4.1. It has an app.config with the bindingRedirect section:

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

However, when I run tests I get a runtime error:

Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I wonder why there is an attempt to load FSharp.Core 4.3.0.0 since bindingRedirect specifies a different version.

1

There are 1 answers

0
Vagif Abilov On BEST ANSWER

Apparently this is a problem with XUnit configutaration. The following section in app.config changed AppDomain configuration:

  <appSettings>
    <add key="xunit.appDomain" value="required" />
  </appSettings>

Then the test runner complained about missing xunit.execution.desktop.dll. Once the file was placed in the execution directory, XUnit runner honored app.config with bindingRedirect settings.