我想将 Newtonsoft.Json dll 从版本 6.0.0.0 更新到版本 8.0.0.0。我还引用了 System.Net.Http.Formatting.dll 版本 5.2.3.0。它在内部引用 Newtonsoft.Json dll 版本 6.0.0.0。
因此我收到以下错误: System.IO.FileNotFoundException:无法加载文件或程序集“Newtonsoft.Json,Version=6.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一。系统找不到指定的文件。
尝试了程序集绑定(bind)并在 app.config 中添加到下面
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
仍然面临同样的问题。
最佳答案
根据 Nuget Gallery 页面,“System.Net.Http.Formatting
”( link ) 不依赖于“Newtonsoft.JSON
”。请查看随附的屏幕截图/链接。
我建议重新安装软件包来解决错误:
Update-Package -reinstall -Project 项目名称
关于c# - 由于 System.Net.Http.Formatting.dll 将 Newtonsoft.Json 6.0 升级到 8.0 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61114416/