Share via


WSDL.exe /parameters switch

WSDL.exe in .NET 2.0 has a great addition, the capability to specify all of the documents for the tool in an XML file rather than in the command line.  For instance, if you use schema imports, you need to provide the schemas at the command line:

wsdl.exe https://localhost/foo/foo.asmx?wsdl https://localhost/foo/foo1.xsd https://localhost/foo/foo2.xsd

Not very pretty, and it can be a pain in the rear to generate correctly.  Like I said, .NET 2.0 makes this simpler.  Using WSDL.exe in .NET 2.0, your command line would change to use the /parameters switch ("/par:" for short) and specify an XML document containing the parameters. 

<wsdlParameters xmlns="https://microsoft.com/webReference/">
<nologo>true</nologo>
<parsableerrors>true</parsableerrors>
<sharetypes>true</sharetypes>
<documents>
<document>https://localhost/foo/foo.asmx?wsdl</document>
<document>https://localhost/foo/foo1.xsd</document>
<document>https://localhost/foo/foo2.xsd</document>

  </documents>
</wsdlParameters>

You can find more information on the wsdlParameters element on MSDN2.  One thing you won't see is updated docs.  Notice the namespace for the wsdlParameters element:  nothing is specified in the docs, but Ralph Squillance points out the proper namespace in his blog.  This is a really cool feature, especially if you have lots of schemas imported in your WSDL.