I need to create XML serializer classes for approximately 65 XSD files, for which I am using Microsoft's XSD.EXE to generate the C# code...
However, I keep running into Window CMD's character limit in the resulting output file (in which XSD.EXE combines the name of every XSD included): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
To make a long story short, it seems that the only way I can get all these to validate and generate together is if I can merge all the XSDs (de-referencing the includes/imports, which XSD.EXE doesn't resolve the schemaLocation anyway) into one big one.
Please tell me that there exists a tool to do this...
What you can do is to create another new file called file.xsd containing all the schema names in it and then the trick is to name the last schema file with .\ as prefix.
<xsd xmlns='http://microsoft.com/dotnet/tools/xsd/'>
<generateClasses language='CS' namespace='MyNamespace'>
<schema>First.xsd</schema>
<schema>Second.xsd</schema>
<!-- more schema files here -->
<schema>.\Third.xsd</schema>
</generateClasses>
</xsd>
Now run the command “xsd.exe /p:file.xsd /classes” and you get the class file generated :)