Support of import in xsd.exe

I was trying to create a C# class with xsd.exe from an schema that imports others schemas like that xsd.exe /c schema.xsd and it fails miserably reporting an error like "The datatype 'xxx' is missing.". Basically xsd.exe doesn't resolve the schemaLocation attribute.

Dare Obasanjo's article addresses the problem, and Scott Hanselman had the same problem -and solved it-.

The solution isn't very nice, but at least it's simple. You have to tell xsd.exe all the schema referenced, xsd.exe /c schema.xsd importedSchema1.xsd importedSchema2.xsd

Comments (2)

  1. Tim Bens says:

    Thank you, great help, I was looking for this.

  2. Alex Dresko says:

    I wrote a quick LinqPad script to make XSD do my bidding..…/xsd-exe-and-imports-a-solution

Skip to main content