Reputation: 221
We are looking for a way to have C# autogenerate classes from an XSD and create C# namespaces using the namespace info in the XSD.
Doesnt seem like you can create a structured (xxxx.yyyy.zzzz) C# namespace from the XSD?
Is there a trick we're missing?
Thanks
Upvotes: 22
Views: 18374
Reputation: 755013
There's a really interesting project XSD2Code on Codeplex. It basically does the same as xsd.exe
- only better, on the command line, and as a Visual Studio plugin.
You just right-click on an XSD file in your solution explorer and run the tool!
You can set any valid .NET namespace as the target namespace for your generated code files.
Update: the XSD2Code tool has been further developed and is now offered as both a free and a paid, commercial tool - see the official home page for more details.
Upvotes: 3
Reputation: 5242
Would this do the trick? the /n allows you to specify a namespace to put the generated class in.
xsd.exe /classes MyXSDInput.xsd /n:MyCsharpNamespace
Upvotes: 43