class name conflict from different dlls
I am using two dlls XeroApi.dll and DevDefined.OAuth.dll both have OAuth class , problem is that i have used OAuth class of XeroApi.dll earlier in my project. Now i am trying to use this OAuth class from DevDefined.OAuth.dll, then it is giving error that OAuth is present in both dll , it is conflicting
VulpesPosted Apr 29, 2014, 9:53 AM
For example, the following code compiles and runs fine until you uncomment:
using N2;
You then get the 'ambiguity' error.
It won't help if you put one of the dlls in the GAC since this won't affect the names of the classes in that dll.
Mrudul GanpulePosted Apr 29, 2014, 9:33 AM
If possible , then how?
VulpesPosted Apr 29, 2014, 8:37 AM
In other words, replace your generic using directive:
using DevDefined.OAuth; // if that's the actual namespace
with:
using OAth2 = DevDefined.OAuth.OAuth;
You'd then need to use Oath2 whenever you want to refer to Oath in this particular dll.
If you want to access a few other classes in the same dll, then you could define aliases for each of them which could just be the class name itself if there's no conflict.
However, if you need to access a lot of classes in that dll, then this approach is impractical and it would therefore be better to use fully qualified type names whenever you need to use the Oath class even if you have to change existing code.