dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.28k stars 5.91k forks source link

Missing parameter in example code for code generation from xsd #42634

Closed IdatBuschmann closed 1 month ago

IdatBuschmann commented 2 months ago

Type of issue

Code doesn't work

Description

Under the header "To generate classes that conform to a specific schema", step 2, the console code example is xsd mySchema.xsd This generates an error message: "Error: Can only generate one of classes or datasets."

The correct call to generate the classes for the schema is xsd mySchema.xsd /c

Page URL

https://learn.microsoft.com/en-us/dotnet/standard/serialization/xml-schema-def-tool-gen

Content source URL

https://github.com/dotnet/docs/blob/main/docs/standard/serialization/xml-schema-def-tool-gen.md

Document Version Independent Id

77c8e5c2-62e7-a5f7-5b3e-bc7bb7ce8691

Article author

@gewarren

Metadata

BartoszKlonowski commented 1 month ago

Indeed, even the help of the xsd.exe says:

xsd.exe -
    Utility to generate schema or class files from given source.

xsd.exe <schema>.xsd /classes|dataset [/e:] [/l:] [/n:] [/o:] [/s] [/uri:]
xsd.exe <assembly>.dll|.exe [/outputdir:] [/type: [...]]
xsd.exe <instance>.xml [/outputdir:]
xsd.exe <schema>.xdr [/outputdir:]

     - OPTIONS -

/classes
    Generate classes for this schema. Short form is '/c'.

Although I don't think that this page says strictly about the classes only, but other "XML Schema Documents" as well, I still believe an additional sentence would be good to have there to emphasize about the options and what to pass to generate mentioned classes, for instance.

I will handle that addition.