Convert sequences to Generic Lists with svcutil

c#, code-generation, svcutil.exe

Solution

To download metadata (incluing xsd schemes) to the current directory use:

svcutil /t:metadata http://.../.../service?WSDL

To generate the client code use:

svcutil *.wsdl *.xsd /language:C# /ct:System.Collections.Generic.List`1

Note: *.wsdl and *.xsd because there could be a lot of service definitions and schemes.

To generate the client code in one step use:

svcutil http://.../.../service?WSDL /ct:System.Collections.Generic.List`1

Problem

I am trying to auto generate some code with svcutil. I have the following within an xsd: ``` <xs:complexType name="ForsikringstilfelleDetalj"> <xs:sequence> <xs:element name="detaljID" type="xs:string" minOccurs="0" maxOccurs="1"/> ``` I then run the following command: ``` svcutil xx.wsdl yy.xsd /ct:System.Collections.Generic.List`1 ``` I then get the following C# code: ``` public ForsikringstilfelleDetalj[] forsikringstilfelle ``` What I wanted was: ``` public List<ForsikringstilfelleDetalj> forsikringstilfelle ``` According to the info on the net the /ct option should tell svcutil to use generic lists for collections. Can anyone see what I am doing wrong?

Original source