vb.net compile error 'abc' is ambiguous in the namespace 'xyz'

后端 未结 4 1773
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 23:28

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

4条回答
  •  -上瘾入骨i
    2021-01-19 00:16

    There can be a few causes for this error. In VB, you should be aware that more names then you're used to from C# are available without class specification. Also, case does not matter in VB, which can further liken the chances on collisions.

    Even in the event that you don't find the actual conflicting issue, you can resolve this in the same way you would in C#: rename it in the Imports statement:

    Imports IM = yourAssembly.Imyinterface
    

    Then change the code such that uses of Imyinterface are replace with IM.

    NOTE: If the error does not point to a particular line, the conflict may be out of your hand. Normally, a full Clean Solution and Rebuild helps a lot, but occasionally a misbehaving file (i.e., another error) causes this error to popup first without clear source. Try to rollback recent changes to the place where it did work.

    You also say it worked on another machine. Chances are that your machine is having a different version of MS Visual Studio or .NET. Check and compare the exact versions.

提交回复
热议问题