f# - 为什么 bindingRedirect 不影响 FSharp.Core 版本

标签 f# assembly-binding-redirect

我有一个针对 F# runtime 4.4.1 的单元测试项目。它有一个带有 bindingRedirect 部分的 app.config:

  <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>

但是,当我运行测试时出现运行时错误:

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.

我想知道为什么会尝试加载 FSharp.Core 4.3.0.0,因为 bindingRedirect 指定了不同的版本。

最佳答案

显然这是 XUnit 配置的问题。 app.config 中的以下部分更改了 AppDomain 配置:

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

然后测试运行器提示缺少 xunit.execution.desktop.dll。一旦文件被放置在执行目录中,XUnit 运行器就会使用 bindingRedirect 设置来验证 app.config。

关于f# - 为什么 bindingRedirect 不影响 FSharp.Core 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46172340/

相关文章:

database - 如何在 f# 的数据表中设置主键?

c# - 并行执行网络服务调用

c# - ASP.NET MVC 需要两个不同版本的 Newtonsoft.Json.dll

f# - 由于 F# 库中的 DLL 加载问题,NUnit 测试失败

.net - 获取 f# 中列表的最后一个元素

f# - F#中的后缀条件运算符

c# - 未在 Azure 包中创建 Web.config

.net - ILMerge 忽略 bindingRedirect

c# - 为什么嵌套字典的反序列化在 C# 中引发异常但在 F# 中有效?