.Net SvcUtil: attributes must be optional
Posted
by Michel van Engelen
on Stack Overflow
See other posts from Stack Overflow
or by Michel van Engelen
Published on 2010-05-31T07:39:03Z
Indexed on
2010/05/31
7:42 UTC
Read the original article
Hit count: 356
Hi,
I'm trying to generate C# code classes with SvcUtil.exe instead of Xsd.exe. The latter is giving me some problems.
Command line:
SvcUtil.exe myschema.xsd /dconly /ser:XmlSerializer
Several SvcUtil problems are described and solved here: http://blog.shutupandcode.net/?p=761
One problem I can't solve is this one: Error: Type 'DatafieldDescription' in namespace '' cannot be imported. Attributes must be optional and from namespace 'http://schemas.microsoft.com/2003/10/Seri alization/'. Either change the schema so that the types can map to data contract types or 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 have to delete them all (in that case, this excercition is over)?
© Stack Overflow or respective owner