How to add the correct version of System.Net.Http dll to a Xamarin forms project

I am trying to add the correct version of System.Net.Http to my Xamarin project. I can't seem to get it through Nuget. I have tried adding it through the add references dialog, clicking Assemblies --> Framework and it says all framework DLLs are already referenced. If I scan my hard drive for System.Net.Http.dll hundreds of entries come up. What is the correct way to add this DLL reference to a Xamarin project? In the future, I believe the base Xamarin projects should have it already since this is about the only way I know of to map WebAPI calls etc.

Best Answers

Answers

  • GeorgeCeaserJrGeorgeCeaserJr USMember
    Accepted Answer

    So if you are using a PCL in Xamarin, it appears you must use the Microsoft.net.http package. (https://www.nuget.org/packages/Microsoft.Net.Http). I realty wish Xamarin would just take care of all of this for you. It is really annoying

  • AlessandroCaliaroAlessandroCaliaro ✭✭✭✭✭ ITMember ✭✭✭✭✭
    I use Microsoft net http in my projects
  • JohnyKamnangJohnyKamnang ✭✭ BEMember ✭✭

    This problem is really annying! It looks like there is a big difference between the version of System.Net.Http for UWP and the one for Xamarin (PCL).
    When I try to install from nuget system.net.http it's not installed because it says already installed...
    If I install the Microsoft.net.http it says: "does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'Task' could be found (are you missing a using directive or an assembly reference?)" for many method...

    Is there a way to select the real system.net.http used id UWP or WindowsPhone....

Sign In or Register to comment.