简体   繁体   中英

Error after upgrading ASP.Net WebAPI nuget package

I have updated my WebApi nuget package from 5.2.2 to 5.2.3 and I started getting this error,

The type 'System.Web.Http.ApiController' exists in both 'c:\\Program Files (x86)\\Microsoft ASP.NET\\ASP.NET MVC 4\\Assemblies\\System.Web.Http.dll' and '\\packages\\Microsoft.AspNet.WebApi.Core.5.2.3\\lib\\net45\\System.Web.Http.dll'

I tried cleaning the solution/deleting reference and stuff but I could not get it working. Please help.

Update#: Reverting all the packages helped. But still not sure if I missed something in the upgrade.

I got the same problem when getting Microsoft.AspNet.WebApi.

At Nuget Package Manager Console write this:

 Update-Package -ProjectName 'YourProjectNameGoesHere' -Reinstall

This will update all your packages and it will solve your problem.I hope it helps

It happens sometimes with upgrades, another solution could be, close your solution and delete the content of packages folder of your solution , except repositories.config , uninstall the WebApi package and dependencies and install the newest version. In some cases you need fix the assemblyBinding in web.config.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM