【问题标题】:Visual Studio Debugging dll dependency errorVisual Studio 调试 dll 依赖错误
【发布时间】:2018-01-23 09:28:02
【问题描述】:

在 Visual Studio 2015 中,我在同一个解决方案中有项目 A(Web Api 应用程序)和项目 B(MVC 应用程序)。

我可以分别调试应用程序 A 和应用程序 B。 但是,当应用程序 B 从 A 调用 rest api 时,我收到来自应用程序 A 的 dll 依赖错误。

“无法加载文件或程序集 'Newtonsoft.Json' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配”。

当我清理构建项目 A 时,第一次调用成功,但是后续调用收到相同的错误。

我该如何解决这个问题?

(我使用 IIS 7.5)

【问题讨论】:

  • 整合你的 NuGet 包。
  • @Ahmet Altun,您现在可以调试您的两个项目吗?如果您有任何最新信息,请随时在此处分享。

标签: visual-studio debugging iis dll


【解决方案1】:

要解决此问题,请确保您的两个项目使用相同的 Newtonsoft.Json 版本。

您可以运行以下命令:

更新包 Newtonsoft.Json -reinstall

请同时查看您的 web.config,也许您可​​以删除旧版本,例如:

 <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />   </dependentAssembly>

一般如果要保证所有的Newtonsoft.Json包都是同一个版本,我们也可以指定版本:

更新包 Newtonsoft.Json -version 6.0.0 -reinstall

参考:

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0

http://blog.myget.org/post/2014/11/27/Could-not-load-file-or-assembly-NuGet-Assembly-Redirects.aspx

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-02
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    相关资源
    最近更新 更多