0

I'm using RestSharp in a portable dll for Xamarin and WP platform. Actually I've created the method GET with this code inside of it:

var client = new RestClient("http://localhost/api/v1/");
var request = new RestRequest(requestUri, Method.GET);
var queryResult = client.Execute(request);

I set up a client with my base url, in the request variable I passed the resource to add to the base url as the documentation says. And finally I execute the request saving the content inside queryResult. The problem is that when I execute this code, on this line:

var client = new RestClient("http://localhost/api/");

I get:

FileNotFoudnException was not Managed
System.IO.FileNotFoudnException in RestSharp.Portable.HttpClient.dll
Cannot load the file or assembly 'System.Net.Http.Primitives, Version = 1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d503a0

what is wrong?

IlDrugo
  • 1,899
  • 3
  • 12
  • 19

1 Answers1

1

You either need to :

  1. Install the Microsoft Http Client Libraries from NuGet.
  2. If already installed, ensure you're on the latest stable version (2.2.29)

Also, check this question for more details, as you may need to add a dependent assembly to your web.config as well.

Community
  • 1
  • 1
X3074861X
  • 3,709
  • 5
  • 32
  • 45