Why doesn't bindingRedirect affect FSharp.Core version

陌路散爱 提交于 2019-12-10 18:26:32

问题


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:


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.



来源:https://stackoverflow.com/questions/46172340/why-doesnt-bindingredirect-affect-fsharp-core-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!