1

更新:我尝试在 web.config 中以不同的组合使用dependentAssembly -> bindingRedirect。我还尝试将 app.config 添加到我的“DataAccess”项目并在其中添加 bindingRedirect。我已经使用了我能想到的所有可能的组合,但是在配置文件和它们自己的配置文件中,但似乎没有任何效果。也许我做错了

我决定尝试使用 n 层架构的 MVC3 + EXT.Net V2.0 和 RavenDB。

我在我的MVC 项目中使用 NuGet 添加了 Ext.Net ,这又添加了Newtonsoft.Json(版本 4.5.7),因为它是一个依赖项。一切都还好,一切都按预期构建和执行。

接下来我决定添加一个新项目“实体”,我将在其中实现我的实体及其存储库接口/类。好的,一切都还不错并且可以构建。

然后我添加了另一个项目"DataAccess"。我手动添加了对与 Raven 捆绑的RavenDB 和Newtonsoft.Json(版本 4.0.8.0)的引用。我实现了一个简单的 RavenDB 会话和存储对象的方法。

我重建了整个解决方案并且没有错误,但是当我运行应用程序时出现以下错误

Could not load file or assembly 'Newtonsoft.Json, Version=4.0.8.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)

Line 17: store = new DocumentStore()(这是在我的“DataAccess”项目中)

堆栈跟踪

[FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.0.8.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)] Raven.Client.Document.DocumentConvention..ctor() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentConvention.cs:84...

有没有办法在不自己重建任何第三方程序集的情况下解决这个错误?

如果我删除对 EXT.Net 和 Newtonsoft.Json (4.5.7) 的引用,RavenDB 代码将自行工作,反之亦然,当我删除对 RavenDB 和 Newtonsoft.Json (4.0.8.0) 的引用时,EXT.Net 代码将工作

4

1 回答 1

0

RavenDB 960 使用 Newtonsoft.Json 4.0.8,你可以使用 RavenDB 1.2 不稳定,它内化了 Newtonsoft.Json 支持。

于 2012-07-16T21:05:13.310 回答