I have the following error when attempting to run a test:
{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)
输出类型:类库
I then added the following app config to my 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>
如果我确实需要app配置,我的bindingRedirect应该设置为什么值?
2 回答
试试
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.1.0" />
. 这就是大多数F#项目似乎为FSharp.Core做的事情 . (或newVersion="4.3.1.0"
,如果升级到更新的FSharp.Core,甚至newVersion="4.4.0.0"
) .您应该在
bindingRedirect/newVersion
中使用最新版本(在本例中为4.3.1.0
),否则,您可能会从Tests.dll
程序集中的代码中获取错误,该代码依赖于较新版本 .或者,您可以更新其中一个程序集中的引用(降级
Tests.dll
或升级ManageAccount.dll
),以便它们都使用相同的版本 .