38

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'

Dunken
  • 8,481
  • 7
  • 54
  • 87

2 Answers2

32

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.

Dunken
  • 8,481
  • 7
  • 54
  • 87
22

FWIW, I had a .NET 4.0 requirement on the client (die WinXP!), but I could do .NET 4.5 on the server. So, I have WebApi2 running server side, but the WebApi1 client package running on the client, handling serialization, etc.

Using the Package Manager Console in Visual Studio and choosing my client project in the default project dropdown, I was able to:

Install-Package Microsoft.AspNet.WebApi.Client -Version 4.0.30506.0

Everything thereafter worked well.

Mike L
  • 4,693
  • 5
  • 33
  • 52