Automatically generate C# from XSD in Visual Studio IDE

You can check out Xsd2Code for a VS addin that does this interactively. The author is also working on a VS2010 version, as far as I know.

alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=Xsd2Code&DownloadId=41336


You can also add it as an external tool (click tools - external tools...) to visual studio (2015). Then just select the xsd schema in visual studio and click tools - xsd to generate the class file.

adding xsd as an external tool

Parameters:

  • Command: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools\xsd.exe (replace with your version of FX tools)
  • Arguments: /c "$(ItemDir)$(ItemFileName)$(ItemExt)"
  • Initial directory: $(ItemDir)
  • Use Output window: yes