ambiguous reference

我怕爱的太早我们不能终老 提交于 2019-12-03 22:32:53

Have you tried right-clicking the solution and doing Clean Solution?

It sounds like your project has two different references to the same assembly.

Get rid of one of them.

I was getting this as an erroneous error message, and my project still built and ran fine for months. It was because someone had put a class in a namespace with different capitalisation to all the other instances of that namespace, so they were effectively two different namespaces. Our code was technically correctl, but the ASPX <%@ Register %> directive complained that it was ambiguous because there were two different symbols with the "same" name; MyNamespace and Mynamespace.

Check your capitalisation.

Have you tried turning it (Visual Studio) off and on again? It worked for me...

Probably your project had a link to an assembly in your solution and also your project class has a using statement to the namespace in referenced assembly.

Remove link to an assembly between projects if they belong to one solution.

This can also happen if you have references two different versions. If you're referencing an assembly in your problem project and also referencing another project that has the same reference but a different version, it's ambiguous which reference to use.

I deleted the "bin" and "obj" sub-directories in each project's directory and the error disappeared.

You are getting this error because you have two class with the same name and the same namespace. You should change the namespace of one of the classes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!