Is it possible to use ASP.NET Web API 2 with .net 4.0? I tried to upgrade from an older version but I get:
Could not install package 'Microsoft.AspNet.WebApi.Client 5.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0'
ASP.NET Web API is a framework that allows you to build Web API's, i.e. HTTP-based services on top of the . NET Framework using a convention based and similar programming model, as that of ASP.NET MVC. These services can then be used in a broad range of clients, browsers and mobile devices.
The latest ASP.NET Web API 2.2 package has the following version: "5.2. 0". You can install or update these packages through NuGet. The release also includes corresponding localized packages on NuGet.
IHttpActionResult contains a single method, ExecuteAsync, which asynchronously creates an HttpResponseMessage instance. If a controller action returns an IHttpActionResult, Web API calls the ExecuteAsync method to create an HttpResponseMessage. Then it converts the HttpResponseMessage into an HTTP response message.
WebAPI requires . net 4. You can't use it on . net 3.5 (sp1 or not).
To answer my own question:
No, it is NOT possible to use Web API 2 with .net 4.0:
This is taken from a slide by Damian Edwards. You can find additinal info here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With