mbx
mbx

Reputation: 6535

What is the best way to generate xsd xml-scheme from a dotnet class?

Usually, when it comes to xml, I write an xsd scheme file and generate the C# class with xsd.exe. But it would be much simpler to wrtie first the C# class(es) with public properties as need for the XmlSerializer to serialize. Unfortunately you don't get any xml scheme to document that output/interface. Generating an xsd scheme from the generated xml file is quite error-prone, as you cannot guess restrictions or constraints. So what is the best way to generate xsd xml-scheme from a dotnet class?

Upvotes: 4

Views: 482

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1063774

xsd.exe assembly.dll /type:Your.Type.Name

Upvotes: 6

Related Questions