首页 文章

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

提问于
浏览
3

我有一个针对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>

但是,当我运行测试时,我收到运行时错误:

无法加载文件或程序集'FSharp.Core,Version = 4.3.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一 . 该系统找不到指定的文件 .

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

1 回答

  • 3

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

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

    然后测试运行器抱怨缺少xunit.execution.desktop.dll . 将文件放入执行目录后,XUnit runner会使用bindingRedirect设置来表示app.config .

相关问题