HttpClient missing in portable .Net subset when creating PCL in Xamarin

I created a portable class library in Xamarin and want to use it for an Android application. I want to use HttpClient in this PCL. I added the Microsoft Http Client libraries from NuGet Package Manager. Now I can see .Net portable subset added to my links. But for some reason, I still cannot use HttpClient , and it also does not appear in the portable .Net subset.

Also, my Current profile for PCL 4.0-Profile 158 . If I change the profile to 4.5, Xamarin will work and will not open the solution

Can anyone help me with this? Thanks

+5
android c # portable-class-library
source share
1 answer

A simple solution is to install the applications .NET 4.5, Windows Store (Windows 8.1), Xamarin.iOS and Xamarin.Android (4.5-Profile7). Then you won't need the HttpClient NuGet package to get these APIs.

If Xamarin crashes when trying to select profile 4.5, make sure you are using the latest version and then report an error with details on how to reproduce it and what is happening.

Also, the HttpClient NuGet package should allow you to use the HttpClient from PCL profile 158. Make sure you are using the latest version of NuGet. The ".NET Portable Subset" should always appear in your PCL links that are not related to the NuGet package. When you install the HttpClient NuGet package, you should also see links to System.Net.Http and other assemblies in your links.

+8
source

All Articles