FSharp.Core:无法加载文件或程序集

Sco*_*rod 2 f#

尝试运行测试时出现以下错误:

{System.IO.FileLoadException:无法加载文件或程序集'FSharp.Core,Version = 3.3.1.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(来自HRESULT的异常:0x80131040)文件名:'FSharp.Core,Version = 3.3.1.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'infister.RegisterResponse .__ DebugDisplay()

Tests.dll

FSharp.Core:3.1.2.5

目标F#运行时:4.3.1.0

目标框架:4.6

输出类型:类库

ManageAccount.dll

FSharp.Core:3.1.2.5

目标F#运行时:3.3.1.0

目标框架:.NET可移植子集(.Net Framework 4.5,ASP.Net Core 1.0,Windows 8)

输出类型:类库

然后我将以下app配置添加到我的测试项目中:

<?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>
Run Code Online (Sandbox Code Playgroud)

如果我确实需要app配置,我的bindingRedirect应该设置为什么值?

rmu*_*unn 5

试试<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.1.0" />.这就是大多数F#项目似乎为FSharp.Core做的事情.(或者newVersion="4.3.1.0",即使newVersion="4.4.0.0"您升级到较新的FSharp.Core).