0

{“无法加载文件或程序集 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常: 0x80131040)":"Newtonsoft.Json,版本=4.5.0.0,文化=中性,PublicKeyToken=30ad4fe6b2a6aeed"}

在 Visual Studio 中使用 Fluent Automation 加载页面时出现上述错误。当我执行以下断言时发生错误:I.Expect.Exists("#sampleId")
我正在使用最新版本的 Newtonsoft Json 和 Fluent Automation。最近有没有人能够解决这个问题?

4

1 回答 1

3

在我看来,Fluent Automation 本身就是在引用旧版本的 Newtonsoft.Json(4.5.0.0),而您说您使用的是最新版本,我相信是 6.0.1 您是否尝试过 bindingRedirects?

这是一个示例,它位于您的 web.config/app.config 中:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- Any other dependentAssembly bindings you need -->
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
于 2014-03-04T16:23:03.007 回答