问题
I'm getting the following error while installing the Breeze Server for Web API 2.0.
Updating 'Microsoft.AspNet.WebApi.Core 5.2.0' to 'Microsoft.AspNet.WebApi.Core 5.1.0' failed. Unable to find a version of 'Microsoft.AspNet.WebApi.WebHost' that is compatible with 'Microsoft.AspNet.WebApi.Core 5.1.0'.
Any help is appreciated.
回答1:
I had similar issue with Visual Studio 2013 Update 3.
Installed Microsoft.AspNet.WebApi.OData first and Breeze.Server.WebApi2 both via NuGet
That issue did not appear. For now lets take that as a quick fix.
回答2:
You must install Breeze.Server.WebApi2 before installing Microsoft.AspNet.WebApi.WebHost.
* EDIT *
This NuGet versioning issue has been fixed in Breeze v1.4.17 (i.e. for the current Microsoft.AspNet... NuGet packages)
* EDIT *
The issue is not with Breeze.Server.WebApi2, but with the Microsoft.AspNet.WebApi.OData package. Breeze.Server.WebApi2 NuGet package requires Microsoft.AspNet.WebApi.OData with version ≥ 5.1 && < 6.0. If you install the Breeze.Server.WebApi2 and Microsoft.AspNet.WebApi.OData is not already installed, it will install the base version (5.1) and not the latest. The issue is that Microsoft.AspNet.WebApi.OData 5.1 depends on Microsoft.AspNet.WebApi.Core version ≥ 5.1.0 && < 5.2.0. That conflicts with Microsoft.AspNet.WebApi.WebHost 5.2 (which you have installed in your solution) as it depends on Microsoft.AspNet.WebApi.Core version >=5.2 and <5.3. So, when Microsoft.AspNet.WebApi.OData is trying to be installed, it will try to roll Microsoft.AspNet.WebApi.Core version to 5.1 and that will fail because Microsoft.AspNet.WebApi.WebHost depends on a newer version.
All this is happening because Breezejs 1.4.16 was tested with Microsoft.AspNet.WebApi 5.1 as version 5.2 had not yet been released at the time. We will update version dependencies on our NuGet packages in the coming release, but this problem is still meant to reoccur in the future as we have no control as to how Microsoft will set their packages dependencies in their coming releases.
The previous workaround is overwork though, as you can simply install the latest Microsoft.AspNet.WebApi.OData package (5.2) before installing Breeze.Server.WebApi2. Microsoft.AspNet.WebApi.OData 5.2 will fulfill the Breeze.Server.WebApi2 dependency and you won’t have installation errors or to deal with the hassle of uninstalling/installing a bunch of packages.
来源:https://stackoverflow.com/questions/25108085/nuget-breeze-server-for-web-api-2-0-install-error