Is svcutil.exe a replacement for xsd.exe?

后端 未结 5 913
一生所求
一生所求 2021-01-31 09:44

I am using xsd.exe to generate some c# classes from a .xsd file. I ran into the same issue that is covered here and on other sites where xsd.exe generates Type[] arrays instead

5条回答
  •  遥遥无期
    2021-01-31 10:37

    Clarification

    Andrew Hare's answer above will work, but the example command that jameswelle pasted just above his last section of code:

    svcutil.exe /target:code /dataContractOnly /serializer:XmlSerializer /importXmlTypes /collectionType:System.Collections.Generic.List`1 Example.xsd

    does not work because, as stated on MSDN, '. . .the /r and /ct switches for referencing types are for generating data contracts. These switches do not work when using XmlSerializer.'

    HTH.

提交回复
热议问题