Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The primary reference could not be resolved because it was built against a higher version than the currently targeted framework

First of all: I have knowledge regarding the immediate solution to the problem in the title.

I know that this problem arises whenever a dll is referenced under a project being built against a different framework.

I have a project being built against .NET Framework 4.0, and I am referencing the RestSharp dll that targets the same framework.

The print below has been taken from JetBrain's DotPeek. Printscreen

Dunno if this print means anything at all, but nonetheless. Vs2010 printscreen

The error being displayed at the Output Window is

The primary reference "RestSharp" could not be resolved because it was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

I am using VS2010.

like image 820
Eric Wu Avatar asked Nov 09 '22 00:11

Eric Wu


1 Answers

You are having that problem because that version of the dll was built using .net framework 4.6.

What you can do to fix it is one of the following:

  1. Find that dll built with .net framework 4.0
  2. Clone the repository and build it yourself pointing to .net framework 4.0
  3. Change your project to target .net framework 4.6
like image 100
David Acero Avatar answered Nov 24 '22 19:11

David Acero