Forum Xamarin.Forms

Making Web request in a PCL library

I am Xamarin Forms for my project. I want to make a POST request to a url in the PCL library. I tried using Microsoft.Net.Http, but I am getting this error.

The currently targeted framework ".NETPortable,Version=v4.5,Profile=Profile78" does not include "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which the referenced assembly "System.Net.Http.Extensions" depends on. This caused the referenced assembly to not resolve. To fix this, either (1) change the targeted framework for this project, or (2) remove the referenced assembly from the project. (MSB3253)

I tried selecting different profiles, but none of them seem to fix this problem ? Which profile should I use to make sure everything works ?

And are there any alternatives to this ? I came across packages like Portable REST, but they seem to rely on Microsot.Net.Http, which makes them useless.

What should I do to fix this problem? Please help.

Best Answer

Answers

  • jefnazariojefnazario USMember ✭✭

    Hi @ArunBalaji,

    I have the same problem when I try to add System.Net.Http.dll with a different version from my project. Try to verify the both versions for the project and System.Net library.

    Try also, check this out on nuget.org.

    Let me know if that solves your problem.
    Best regards.

  • stvansolanostvansolano UMInsider, University ✭✭✭
    edited May 2015

    Hello guys,

    You might consider using RestSharp to make it easier:

    https://components.xamarin.com/view/restsharp/

Sign In or Register to comment.