I have 2 XSD files A.xsd and B.xsd and both of them importing a common xsd file C.xsd , upon converting them to C# files using XSD.exe, both of them has classes incuding the classes from C.XSd (common XSD)
Sample Code: first c# file from xsd 1:
[System.Xml.Serialization.XmlTypeAttribute(Namespace="xyz")]
public partial class ABC {
}
[System.Xml.Serialization.XmlTypeAttribute(Namespace="xyz")]
public partial class ABC {
}
This is causing a run time error :
Types 'First C# file.ABC' and 'Second C# file.ABC' both use the XML type name, 'ABC', from namespace 'xyz'. Use XML attributes to specify a unique XML name and/or namespace for the type
I do not want to change the namespace as the complex types form third party XSD maps to this namespace.
I tried TypeName Attribute
, but this seems to not work.
Please help me to on this situation.
I am running xsd.exe
twice because A.xsd and B.xsd are huge files and running them in a single command would result in huge single auto generated C# file, so I wanted to generate separate C# classes for A.xsd and B.xsd.