Search code examples
c#.netwindows-store-appsxsd.exe

Generating Classes from XSD schema


I am porting an old .NET 2.0 Library to a portable .NET Project. Target of the Project is Windows 8.1.

My Library contains some classes which were generated by the XSD Tool by a XSD schema definition. Theses classes contain the [Serializable] Attribute which is not allowed for Windows Store Apps. I read that I have to use the Attributes [DataContract] and [DataMember] instead. I tried to regenerate the classes from the xsd schema again with the xsd tool which comes with Visual Studio 2015 but without success. It still generated the classes with the [Serializable] Attribute. I used the following command

xsd myschema.xsd /c 

So can I generate classes from xsd schema which are valid for Windows Store Apps?

Regards

Michael


Solution

  • you can use xsd2code VS extension, its much more powerful than Microsoft xsd tool, there are options to support WinRT.

    however its not free, but you can use trial version which is fully functional for 15 days.

    Note that current version is not compatible with VS 2017, but it works for older visual studios.