3

In my xamarin application I need to implement the web-service using HttpClient.

So I create the test project & test the web-service - No problem here.

My code:

public async Task<string> registrationRequest()
    {
        HttpClient client = new HttpClient();
        string response = await client.GetStringAsync(registrationURL);

        return response;
    }

My problem:

After test the testing application I use the same code in my live project system.net.http not found error.

HttpClient - not resolved.

In my test project I am not install any Nuget packages.

I just use the

using System.Net.Http;

But in my live project this import return error.

Anyone help me out..

1 Answer 1

11

You need to install the Microsoft.Net.Http nuget package in your PCL and platform-specific projects.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks problem solved.. one doubt - In my test project I am not install this.. How this works in my test project?
Is it possible you were using shared code instead of PCL for your test project?
No bro.. i am use the code in PCL. In PCL this import working without any library installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.