I have a program (Main application which consists of legacy code ) which consumes a library. Sadly, both main application and the library uses a classes (with same name and same properties) called Softwares.SoftwareXSD. When I use the class defined inside Softwares.SoftwareXSD, the main program complains about ambiguity. However, Visual Studio is saying that it is smart enough to choose within the duplicates by displaying a green underline under the class name. I believe this is not a good approach.
Is there any any problem with this? What is the best workaround for this situation?
The problem is that some classes in the XSD is specific to main application and some is specific to the library but these classes are linked with each other using references.
If I understand your question right, you have two classes
Softwares.SoftwareXSDin different assemblies (main application and library) whose fully-qualified name is identical.To resolve this, go to Solution Explorer in Visual Studio, expand “References”, right click on the reference to your library and select properties.
In “Aliases” replace “global” by some other alias, e.g. “library”.
You can now disambiguate the references as follows:
Nevertheless, I’d still recommend you to choose unique names for your classes.