none
Xsd.exe class generation for Metro style apps

    Question

  • We are attempting to generate C# classes using xsd.exe and some xml schemas.  The code generated does not compile for Metro style applications, because of the [SerializableAttribute] which is not available in .NET for Metro apps.  Is there/will there be a Metro compatible version of xsd.exe or some other tool to generate code from schemas?  Is it safe to simply remove the [SerializableAttribute] from the generated code and use that in a Metro style app?

    Monday, April 16, 2012 9:18 PM

All replies

  • hi,

    Mabye the XML, System.Xml, MSXML and XmlLite forum is the correct for you.

    Thursday, April 19, 2012 7:46 AM
  • I'm in the same position as Ari.

    Below is an example of the attributes on a partial class created from an XSD using xsd.exe

    The compiler isn't happy with the SerializableAttribute() and the DesignerCategoryAttribute() lines.

    Any advice on how to amend the .cs file would be appreciated. (DataContext?)

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://Submission")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace="http://Submission", IsNullable=false)]
    public partial class UnsanitisedSubmission {

    • Edited by RD8388 Monday, August 05, 2013 4:04 PM moved question above code
    Monday, August 05, 2013 4:02 PM