【问题标题】:How can I see what's requiring NewtonSoft.Json 6.0.0.0 when everything in my solution references 8.0.3?当我的解决方案中的所有内容都引用 8.0.3 时,如何查看需要 NewtonSoft.Json 6.0.0.0 的内容?
【发布时间】:2017-03-22 16:12:13
【问题描述】:

我的 VS2015 解决方案 (4.5.2) 有 3 个项目和 3 个进一步的测试项目。 4 个项目引用 NewtonSoft.Json,全部设置为使用 8.0.3 版本

所有 app.config 和 web.config 文件都包含重定向

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
           <assemblyIdentity name="Newtonsoft.Json"
               publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
           <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
       </dependentAssembly>
    </assemblyBinding>
</runtime>

(并且配置标签没有命名空间属性)

我在我的开发盒上运行我的测试,一切都很顺利。

我部署到我们的构建服务器 (TeamCity),但我的 47 次测试都失败了

System.IO.FileNotFoundException:无法加载文件或程序集 'Newtonsoft.Json,版本=6.0.0.0,文化=中性, PublicKeyToken=30ad4fe6b2a6aeed' 或其依赖项之一。这 系统找不到指定的文件。

每个编译好的项目在其/bin/Release文件夹下都有一份NewtonSoft.Json.Dll的副本,都是8.0.3版本

构建服务器的 GAC 中包含 NewtonSoft.Json.Dll 版本 8.0.3

所以这是我需要知道的...

我怎样才能知道版本 6.0.0.0 的要求是什么?
以及
如何杀死它?

【问题讨论】:

  • FusionLog 帮助我了解发生了什么。某些东西(在日志中列为程序集:(未知))要求 6.0.0.0 并且 dll 的配置文件(位于 dll 旁边的 /bin 文件夹中)是“未找到”的,因此 .Net 直接连接到机器.config 没有重定向,因此请求失败。作为一种解决方法,我添加了对 machine.config 的重定向,因此任何对 6 的请求都将得到 8,一切都很好,但我仍然想知道谁要求 6,以及为什么看不到项目配置文件。 .

标签: c# json dll json.net filenotfoundexception


【解决方案1】:

您必须启用 FusionLog 才能查看哪个 dll 要求此版本的 Newtonsoft。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-01
    • 2021-02-21
    • 2013-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多