我最近将 SharpMap 添加到我的一个项目中。然后,同一解决方案中的不同项目会抛出此问题:
An exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll but was not handled in user code
Additional information: 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)
我搜索解决方案并发现: 无法加载文件或程序集'Newtonsoft.Json,版本 = 4.5.0.0,文化 = 中性,PublicKeyToken = 30ad4fe6b2a6aeed'
但实际上并没有解决问题:
Update-Package : Unable to resolve dependencies. 'Newtonsoft.Json 7.0.1' is not compatible with 'SharpMap 1.1.0 constraint: Newtonsoft.Json (= 4.5.11)'.
At line:1 char:16
+ Update-Package <<<< Newtonsoft.Json
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
关于可能与问题相关的项目结构的更多信息:
“Project A”是使用 SharpMap 的启动项目。“Project B”是失败的那个,“Project A”引用“Project B”。