XSD.exe: Error generating classes for schema 'MySchema.xsd'. - The element 'http://schemas.DomainName.com/types:MyType' is missing.

If you are getting this kind of error it is probably because the XSD.exe utility is not following imports and/or includes in your XSD. To solve this issue, specify all the required XSD files directly on the command line as follows:

xsd.exe /c MySchema.xsd Import01.xsd Import02.xsd Include01.xsd Include02.xsd

where Import01.xsd, Import02.xsd, Include01.xsd and Include02.xsd are XSD files referenced via import and include elements in MySchema.xsd.