I am trying to create C # code classes using SvcUtil.exe instead of Xsd.exe. The latter gives me some problems.
Command line:
SvcUtil.exe myschema.xsd /dconly /ser:XmlSerializer
Several SvcUtil problems are described and resolved here: http://blog.shutupandcode.net/?p=761
One problem that I can’t solve is: Error: the type “DatafieldDescription” in the namespace “cannot be imported. Attributes must be optional and from the namespace http://schemas.microsoft.com/2003/10/Seri known share / ". Either modify the schema so that types can match data contract types, either use ImportXmlType or use a different serializer.
I changed
<xs:attribute name="Order" use="required">
to
<xs:attribute name="Order" use="optional">
and
<xs:attribute name="Order">
But the error remains. Is it possible to use attributes, or do I need to remove them (in this case, this completion is complete)?
source share