user3731783
user3731783

Reputation: 718

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.

Upvotes: 0

Views: 1141

Answers (2)

Alberto Montellano
Alberto Montellano

Reputation: 6286

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

Upvotes: 1

Jesus Angulo
Jesus Angulo

Reputation: 2666

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.

Upvotes: 0

Related Questions