刚升级ASP.NET MVC4项目以使用Unity.WebApi版本5.0.0.0,它需要System.Web.Http v 5.0.0.0,因为以下错误:
Assembly 'Unity.WebApi, Version=5.1.0.0, Culture=neutral, PublicKeyToken=43da31bc42a85347' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
我目前正在引用System.Web.Http v4.0但是将以下NuGet包升级到各自的最新版本:
-
ANTLRv3
-
Microsoft ASP.NET通用提供程序
-
Microsoft.Web.Infrastructure
-
Microsoft ASP.NET MVC
-
Microsoft ASP.NET Razor
-
Microsoft ASP.NET Universal Providers核心库
-
Microsoft ASP.NET通用提供程序
-
Microsoft ASP.NET Web API 2客户端
-
Microsoft ASP.NET Web API 2核心
-
Microsoft ASP.NET Web API 2 Web主机
-
Microsoft ASP.NET Web API 2
-
Microsoft ASP.NET网页
-
Microsoft.Web.Infrastructure
-
WebGrease
通过NuGet . 我没有列出相关的JavaScript库,如Micrososft.jQuery.Unobtrusive Validation等 .
什么是升级System.Web.Http的NuGet包,还是我必须手动执行此操作?
2 回答
你需要Microsoft.AspNet.WebApi.Core包 .
您可以在.csproj文件中看到它:
我在解决方案中有几个项目 . 对于某些项目,我之前手动添加了参考 . 当我使用NuGet更新WebAPI包时,这些引用不会自动更新 .
我发现我可以手动更新这些引用,以便它们指向我的解决方案的Packages文件夹中的v5 DLL或执行以下操作 .
转到"Manage NuGet Packages"
选择已安装的包"Microsoft ASP.NET Web API 2.1"
单击“管理”并检查之前手动添加的项目 .