.6 WebApi conflict in Win8/Metro App

256 views Asked by At

I am trying to use the .6 WebApi in a C# metro app. I am able to add the .6 dll references to a win8 console app, but I can't get it to work in a Metro/Xaml app. I can add Microsoft.Net.Http.Formatting, but when I add System.net.http, it conficts with the Systemm.net.http dll in the GAC I think.

var resp = httpClient.GetAsync("").Result;
Person person = resp.Content.ReadAsAsync<Person>().Result;

Has anyone been able to do this simple two lines of code in a Win8/Metro/Xaml app?

As I mentioned before this works in a console app if you change the target framework from .net Framework 4.5 Client Profile to .Net Framework 4.5

1

There are 1 answers

2
Pedro Felix On

The System.Net.Http classes in WCF Web API are a 4.0 version of the new System.Net.Http classes in 4.5. When developing for Win8, use the .NET 4.5 assemblies instead.