WsdCodeGen Configuration File
A WsdCodeGen configuration file is usually generated by the WsdCodeGen tool. You can create configuration files manually, but the complexity and length of the file typically precludes hand-coding. We strongly recommend using WsdCodeGen to generate the file. For more information about generating configuration files, see Using WsdCodeGen and WsdCodeGen Command Line Syntax.
You should inspect the generated configuration file, and if necessary, modify it before using it to create source code. The configuration file generated by WsdCodeGen is typically sufficient for most client development.
To use the configuration file for server development, some modifications are required. If hosting is enabled (i.e., if "all" or "host" mode is selected), modify the contents of the ThisModelMetadata element and its child elements as necessary. Also, modify or remove the PnPXDeviceCategory, PnPXHardwareId, and PnPXCompatibleId elements inside the ThisModelMetadata element or Hosted elements as necessary.
A configuration file consists of a sequence of elements that provide input data for code generation followed by any number of file elements that describe the files to be generated. Input data includes a few global properties and references to types expressed in WSDL, XSD, and managed assemblies. Text and CDATA in file elements are written to the generated files without modification. Other elements in file elements are replaced in the generated files with generated code.
XML configuration files must follow a few general rules in order to be properly formatted for use with the code generator utility. These are:
The root element of any configuration file is wsdCodeGen.
Elements that contain simple data types are interchangeable with attributes. For example:
<wsdCodeGen> <layerNumber>1</layerNumber> </wsdCodeGen>
is equivalent to:
<wsdCodeGen layerNumber="1"/>
In general, there is no constraint on the ordering of elements. For example:
<wsdCodeGen> <layerNumber>1</layerNumber> <layerPrefix>MEDIA_</layerPrefix> </wsdCodeGen>
is equivalent to:
<wsdCodeGen> <layerPrefix>MEDIA_</layerPrefix> <layerNumber>1</layerNumber> </wsdCodeGen>
However, the code generator does process the configuration file in a single pass, and ordering does has some relevance. For example, file elements that generate code relating to a particular port type must occur after the element that instructs the code generator to read the port type contract.
For a complete list of elements used in WsdCodeGen configuration files, see WsdCodeGen Configuration File XML Reference.
Sample configuration files are included with the Windows SDK. For more information, see WSDAPI Samples.
Related topics