Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2010: Incompatible Reference when trying to add reference

VS2010: In my newly created project, any time I try to add a reference to any of my other projects or, in this case, MySql.Data...I get an error that says "Incompatible Reference" - "In order to add it you should to change the project's target to a compatible framework first"

My project's target is set to .NET 4 and whether or not the reference I'm trying to add is or isn't set to .NET 4 I still get the error. Anyone got any suggestions? Thanks

like image 813
J Benjamin Avatar asked Mar 23 '11 15:03

J Benjamin


People also ask

How do I resolve a reference problem in Visual Studio?

To fix a broken project reference by correcting the reference path. In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears. If you're using Visual Basic, select the References page, and then click the Reference Paths button.

How do I manually add a reference in Visual Studio?

Add a reference Reference Manager opens and lists the available references by group. Select a reference to add, and then select OK. If you don't see the reference you're looking for, select Browse to locate the reference. (If you're developing C++ projects, you might not see a browse option.)


2 Answers

well I'm not sure what the problem was but if I browse to the physical file to add the reference instead of using the "Recent" or other dialogues in the the Add References window, it works just fine. Never figured out why the other way stopped working for me.

like image 158
J Benjamin Avatar answered Nov 15 '22 20:11

J Benjamin


I had the same problem. The problem was resolved by adding the reference to the compiled dll file. It would work for me, but I got curious why this worked and the reference of the project doesn't.

I checked the project that I wanted to reference. In this project two more projects are referenced. I resolved the error by doing the following:

  1. Added the project (x) to my solution that I liked to reference
  2. Added the projects (ref1 and ref2) that are referenced in the reference project (x).
  3. Added the reference (x) to the consumer project
  4. No error occurred.

I hope this helps you in the future.

Regards,

Stefan

like image 44
Stefan Avatar answered Nov 15 '22 22:11

Stefan