HttpCLient in portable library

Hi.

I want to use the HttpClient from System.Net.Http.
There is no problem if I inlcude it directly in my Android Solution, but I can not add it to my portable library.
It is my understanding that the HttpClient should be available for a portable library?

//Rickard

Posts

  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    edited December 2013

    Which profile are you targeting? If you select Profile7(.net 4.5, android, ios, windows store) then HttpClient will be included. Once you select WP7.5/8 then you will have to download and include the HttpClient NuGet since it is not included.

    If you need NuGet in Xamarin Studio check out my post: http://motzcod.es/post/70123632157/xamarin-studio-nuget-pcl-support

  • rhermarherma SEMember

    Thank you.

    //Rickard

  • Hi,

    I installed Xamarin Studio from alpha channel on my MAC and I can't use HttpClient.
    I put profile 78 and NuGet plugin but when I try to add HttpClient package I have this error :

    Could not install package 'Microsoft.Bcl.Build 1.0.13'. You are trying to install this package into a project that targets 'portable-Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
    System.InvalidOperationException: Could not install package 'Microsoft.Bcl.Build 1.0.13'.

    What is it wrong ?

    Thank you

  • SKallSKall USMember ✭✭✭✭

    You will need to use Microsoft.Net.Http libraries. Using HttpClient from PCL is a PITA, mainly due to WP8 not supporting synchronous web traffic. You would either have to use the MS libraries or compile Mono's libraries without synchronous functions to a PCL library.

  • This error:

    Could not install package 'Microsoft.Bcl.Build 1.0.13'. You are trying to install this package into a project that targets 'portable-Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. System.InvalidOperationException: Could not install package 'Microsoft.Bcl.Build 1.0.13'.

    Is probably caused by using an older version of NuGet (one that doesn't have PCL and Xamarin/PCL support). Make sure to get the latest version of NuGet. For Visual Studio it is 2.7.2, and here are the install instructions: docs.nuget.org/docs/start-here/installing-nuget

Sign In or Register to comment.