xsd command and multiple xsd files

June 3rd, 2008 by John Selkirk. Posted in C#, Software Development

I use the .net xsd command heavily but this is the first time that I have needed to generate a class when the xsd itself references other xsd files.

When I run the command as I normally use:

xsd /c <Name of the XSD file>

With multiple XSD imports though I get an error saying ‘Error: Error generating classes for schema’ due to it not being able find the externally referenced types.

The answer found here is to add the referenced xsd files to the end of the command like so:

xsd /c <Name of the XSD file> <Referenced file 1> <Referenced file 2> ..

This generates a file properly but it has a name created from the concatenation of all the xsd files involved:

<Name of the XSD file><Referenced file 1><Referenced file 2>.xsd

Simple rename of the file to something less verbose and all works fine.

  1. 1 Trackback(s)

  2. Jan 5, 2009: Recent Links Tagged With "xsd" - JabberTags

Post a Comment