如何修复 Newtonsoft.Json 程序集加载错误?

How to fix Newtonsoft.Json assembly loading error?

我正在尝试将预先存在的 Umbraco CMS 站点加载到 Visual Studio 项目中,但我陷入了一些 DLL 地狱。

这是我在尝试编译站点时收到的错误消息:

Could not load types from assembly Umbraco.Core, Version=1.0.5462.37503, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

我尝试从 NuGet 重新安装 Newtonsoft,从 NuGet 重新安装 Umbraco,删除所有 DLL 并重新安装,删除 Newtonsoft dependentAssembly,我已经找到的所有可能的解决方案和这个错误继续上来。

有什么建议吗?

我猜 web.config 文件中的绑定重定向设置不正确。在 nuget 包管理器控制台中尝试 运行:

PM> Get-Project –All | Add-BindingRedirect

这最终成为我关注 Umbraco 视频的一个误会。我试图建立一个新的 Visual Studio 项目,导入所有需要的 DLL,然后将站点内容移动到项目中。

我真正需要做的就是创建一个空白项目,然后将站点内容及其所有 DLL 移动到该项目中。这让我立即开始编辑项目。

最好的解决方案是安装较早版本的软件包,然后升级。