Some people might have wondered why I used ASP.NET MVC 3 in my previous blog post. The reason is that the RavenDB.Client package uses Newtonsoft.Json and ASP.NET MVC 4 also has a dependency on Newtonsoft.Json. In itself this isn’t a problem except that RavenDB requires Newtonsoft.Json version 4.0.8 and ASP.NET MVC 4 ships with a much newer version of Newtonsoft.Json, to be exact version 4.5.6.
The result is that trying to Install-Package RavenDB.Client produces the following error:
Install-Package : Updating ‘Newtonsoft.Json 4.5.6′ to ‘Newtonsoft.Json 4.0.8′ failed. Unable to find a version of ‘Microsoft.AspNet.
WebApi.Client’ that is compatible with ‘Newtonsoft.Json 4.0.8′.
Does that mean you can’t use RavenDB with ASP.NET MCV 4?
No fortunately you can still go ahead and user RavenDB.Client. Instead of the default package you need to installl a specific version which is build with the same version of Newtonsoft.Json as ASP.NET MVC4.
1: Install-Package RavenDB.Client -Version 1.0.971
After including this package, and copying the code from the previous post. We can run the ASP.NET MCV 4 application and we get to see the same books as before except now with the new stying.
However one thing to keep in mind is that RavenDB.Client is the only RavenDB NuGet package build against this version of Newtonsoft.Json. There is no updated version of RavenDB.Server or any of the other packages and that includes RavenDB.Embedded which can be very useful if you want to embed RavenDB server and client into one application. See this blog post by Ayende Rahien for more details on this NuGet package.