Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft ASP.NET Web API 2 on .net 4.0

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'

like image 746
Dunken Avatar asked Nov 13 '13 12:11

Dunken


People also ask

What is ASP Net Web API 2?

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.

What is the latest version of ASP Net Web API?

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.

What is difference between IHttpActionResult and HttpResponseMessage?

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.

Does .NET 3.5 support Web API?

WebAPI requires . net 4. You can't use it on . net 3.5 (sp1 or not).


1 Answers

To answer my own question:

No, it is NOT possible to use Web API 2 with .net 4.0:

enter image description here

This is taken from a slide by Damian Edwards. You can find additinal info here.

like image 193
Dunken Avatar answered Dec 07 '22 13:12

Dunken