VS2010:尝试添加引用时引用不兼容
VS2010:在我新创建的项目中,任何时候我尝试添加对任何其他项目的引用,或者在本例中是 MySql.Data...我都会收到一条错误,提示“不兼容的引用”-“为了添加您应该首先将项目的目标更改为兼容的框架”
我的项目的目标设置为 .NET 4 并且无论我尝试添加的引用是否设置为 .NET 4 我仍然收到错误。有人有什么建议吗?谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
好吧,我不确定问题是什么,但如果我浏览到物理文件来添加引用,而不是使用“添加引用”窗口中的“最近”或其他对话框,它就可以正常工作。从来不明白为什么另一种方式对我不起作用。
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.
我也有同样的问题。通过添加对已编译的 dll 文件的引用解决了该问题。它对我有用,但我很好奇为什么它有效,而项目的参考却不起作用。
我检查了我想要参考的项目。在这个项目中还引用了两个项目。我通过执行以下操作解决了该错误:
我喜欢参考的解决方案
ref2) 中引用的
参考项目 (x)。
对消费者的参考 (x)
项目
我希望这对您将来有所帮助。
问候,
斯特凡
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:
solution that I liked to reference
ref2) that are referenced in the
reference project (x).
reference (x) to the consumer
project
I hope this helps you in the future.
Regards,
Stefan
您消除了出现此错误的明显原因。剩下的就是添加一个为在另一个目标平台上运行而构建的程序集。例如 Silverlight 或 Windows Phone。您不能混合使用这些平台,它们运行不同版本的 CLR 和 mscorlib。没有捷径,您必须重建程序集。
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,
我们创建了一个可以帮助您实现目标的工具。 Muse VSReferences 将允许您添加全局程序集缓存从“添加 GAC 参考”菜单项对项目的参考。
问候
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.
Regards
我在 .Net Framework 4.0 上编译的 .Net 程序集也遇到了同样的问题
经过大量搜索后,我发现问题...对于我的情况是我在 Windows 注册表中创建的引用,以在 Visual Studio 引用屏幕中查看我的程序集:
HKEY_CURRENT_USER\Software\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx\BNB.Seguranca.V2.0
该值在注册表值的开头有一个空格,这导致在正确的文件夹中找到程序集时出现问题。
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.