Noel
Noel

Reputation: 384

Issue with RestSharp installation in Visual-Studio 2013

I am trying to use RestSharp in my C# Visual-Studio 2013 project to POST data at a given URL. When i try to install the package via NuGet it gives me the following error:

Installing 'RestSharp 106.1.0'.
Successfully installed 'RestSharp 106.1.0'.
Adding 'RestSharp 106.1.0' to WebApplicationJson.
Uninstalling 'RestSharp 106.1.0'.
Successfully uninstalled 'RestSharp 106.1.0'.
Install failed. Rolling back...
Could not install package 'RestSharp 106.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

As far as I have read in GitHub this is mostly an issue for .NetPortable framework so I am out of ideas. I have also tried to change my framework version to 3.5 but still the same error.

Has anyone encountered a similar issue?

If you need further information please comment.

Upvotes: 19

Views: 31555

Answers (3)

KR Akhil
KR Akhil

Reputation: 1017

This also happens if the name of your project is RestSharp.

Upvotes: 2

Alexey Zimarev
Alexey Zimarev

Reputation: 19610

The latest version, which supports old .NET Framework versions, is 105.2.3.

Install-Package RestSharp -Version 105.2.3

Since the lowest .NET Framework LTE, which supports async methods is 4.5.2, support of legacy framework has been removed in favour of supporting .NET Standard 2.0 (and .NET Framework 4.5.2).

Upvotes: 37

Noel
Noel

Reputation: 384

If anyone encounters this kind of problem in the future. I solved it by installing it via Package Manager Console found in (Tools -> NuGet Package Manager -> Package Manager Console) and running the following command:

  Install-Package RestSharp -Version 103.1.0

Notice that the installation for RestSharp version 106.1.0 always kept failing, so I changed the version to 103.1.0. Hope this helps anyone with a similar issue.

EDIT

Thanks to phuzi in the comments, RestSharp version 106.1.0 requires .Net framework 4.5.2, as for version 103.1.0 no dependencies are listed.

Upvotes: 14

Related Questions