开发者

VS2010: Incompatible Reference when trying to add reference

开发者 https://www.devze.com 2023-02-19 01:10 出处:网络
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开发者_StackOverflow an error that says \"Incompatible 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开发者_StackOverflow 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


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.


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


You eliminated the obvious reason to get this error. What's left is adding an assembly that was built to run on another target platform. Like Silverlight or Windows Phone. You can't mix these platforms, they run with a different version of the CLR and mscorlib. No shortcut for that, you'll have to rebuild the assembly.


J Benjamin,

We've created a tool that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.

VS2010: Incompatible Reference when trying to add reference

Regards


I was having the same issue with my .Net assembly compiled at .Net Framework 4.0 After search a lot, I find the problem...to my case was the reference that I created in windows registry to see my assembly in Visual Studio References Screen: HKEY_CURRENT_USER\Software\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx\BNB.Seguranca.V2.0

the value was with a empty space in the begin of the registry value, that was causing a problem do find the assembly in correct folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号