Search code examples
c#.netxmlxsdxsd2code

What is the best tool for generating C# classes out of XSD?


Is there a modern and regularly updated tool for generating C# v.7+ classes of XSD? The only tool I know is xsd2code but it is not free and its last update, according to the official site was "Update 4.4 (June 05, 2017)"


Solution

  • There is an alternative tool:

    xsd.exe

    Run it like this:

    xsd /c /namespace:myCompany /language:CS XMLFile.xsd
    

    I have tried it with this XSD, saved it to disk, and runned the tool. It seems to work.

    It's available in the VS-20XX command prompt or, in my case in:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools

    For more info on the path: see: where to find xsd.exe in visual studio 2013 on windows 8