所以我开始在 NopCommerence 的现有项目上工作,我不小心将 Newtonsoft.Json DLL 添加到 Nop.Core 项目中,从那时起,该项目一直随机崩溃并给我错误:
Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我立即从项目中删除了引用,因此现在 Nop.Core 项目中没有对该 DLL 的引用。
但是项目中有一些代码是在寻找引用:
当我们找到那个插件时它崩溃了:
我什至不知道去哪里解决这个问题,看起来它正在尝试加载两个不同版本的 DLL,当我谷歌搜索时,它说要通过 NuGet 进行更新,而我这样做了,但没有解决它。
最佳答案
所以你删除了引用,但是实际的 dll 文件呢?看起来有些东西在运行时“发现”了它,它存在于您磁盘上的某个地方,应用程序正在寻找它。
很难知道要建议什么,但尝试找出应用程序在哪里寻找插件文件,然后在该目录中查找并删除 Json 内容。您也可以尝试删除整个解决方案中的所有 bin 和 obj 目录,因为它们将在下一次构建时重新创建。还要查看解决方案根目录中的 packages
目录,您可能会发现 Json 包的副本在那里徘徊。如果您确实使用 NuGet 删除了它,那么也将其从 packages
中删除。
开始之前先备份一份,以防我的建议完全是垃圾;-)
关于c# - NopCommerce Nop.Core 冲突 DLL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31083931/