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'

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

If you check @MikeL below, that's a valid workaround.
This only works on the client side. On the server you need .net 4.5!
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.

1 Comment

nice! web API 1 is fine for alot of client calls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.