Compilation error vb.net "abc" is ambiguous in the namespace "xyz"

I have a VB.Net solution that was created by another developer, and I'm trying to compile it on our build machine (it compiles on their machine), but with one of the projects I get an error message:

Imyinterface ambiguous in the namespace anamespaceassembly .

I tried without success:

  • reviewed links to see obvious errors
  • the corresponding assembly is deleted and re-added
  • was looking for a system for the same dll
  • tried to compile deve src source file (.v version of source code)
  • reviewed assembly using ildasm.exe

I usually code in C # and have not seen this error before (in this form, at least), and not that it is specific to VB.Net, but the user interface for adding / viewing links is slightly different, so I thought, maybe maybe VB.Net can do something else with links.

I also tried to compile on another machine, and it compiles fine. Therefore, I suppose this is something with a collector, but I'm not sure what. Are there any other conflicting assemblies that somehow do not reference the project?

Any ideas?

+4
source share
4 answers

There may be several reasons for this error. In VB, you should know that the more names you used for C # are available without a class specification. In addition, the case does not matter in VB, which can further compare the chance of a collision.

Even if you do not find the actual conflict problem, you can solve this problem the same way as in C #: rename it to the Imports statement:

 Imports IM = yourAssembly.Imyinterface 

Then change the code so that the use of Imyinterface replaced by IM .

NOTE. If the error does not indicate a specific line, the conflict may be out of your hands. Typically, a complete Clean and Rebuild solution helps a lot, but sometimes an incorrect file (i.e., another error) causes this error to pop up first without a clear source. Try undoing recent changes to where it works.

You also say that it worked on another machine. Most likely, your machine has a different version of MS Visual Studio or .NET. Check and compare the exact versions.

+2
source

Check your links if you have two versions of the same help (for example, Microsoft.ReportViewer.Webforms version 10.0.0.0 and Microsoft.ReportViewer.Webforms 8.0.0.0). You will get this error. Remove the oldest and you have to be good. I do this for myself all the time.

+2
source

I faced the same problem. I upgraded my application from vb6 to vb.net, and when I changed the build configuration from DEBUG to RELEASE, I got AMBIGUOUS errors. I found the duplicate links folder in Solution Explorer. I deleted these duplicate reviewers and successfully completed the build. Hope this can help others.

+1
source

Thanks for answers! I tried every one but still had problems.

One of the points of information that I missed from the original question was that VB.net projects are updates from VB6 projects. At that time, I did not think it mattered.

After further study, the construction machine was also used to create VB6 projects. So I ran "reg32 / u" in the vb6 dll and it seems to fix the VB.net problem.

It is not entirely clear why this has been fixed since I did not refer to the VB6 DLL, I assume that there is something to do with ambiguous registry entries, obfuscating the vb.net project.

0
source

All Articles