.net – Getting Microsoft.AspNet.WebApi.Cors version issue in WebAPI

asp.net-mvcasp.net-web-apicross-domainnetweb services

I have installed Microsoft.AspNet.WebApi.Cors package using Install-Package Microsoft.AspNet.WebApi.Cors in my WebApi project(.net framework 4.5.2) and now I'm getting below error while compiling the project.

Reference: http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

Assembly 'System.Web.Http.Cors, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Best Answer

You need to install following nuget package for this.

Install-Package Microsoft.AspNet.WebApi.Cors.ko -Version 5.0.0

This will work.