SGen task

Creates an XML serialization assembly for types in the specified assembly. This task wraps the XML Serializer Generator tool (Sgen.exe). For more information, see XML Serializer Generator tool (Sgen.exe).

Parameters

The following table describes the parameters of the SGen task.

Parameter Description
BuildAssemblyName Required String parameter.

The assembly to generate serialization code for.
BuildAssemblyPath Required String parameter.

The path to the assembly to generate serialization code for.
DelaySign Optional Boolean parameter.

If true, specifies that you only want to place the public key in the assembly. If false, specifies that you want a fully signed assembly.

This parameter has no effect unless used with either the KeyFile or KeyContainer parameter.
KeyContainer Optional String parameter.

Specifies a container that holds a key pair. This will sign the assembly by inserting a public key into the assembly manifest. The task will then sign the final assembly with the private key.
KeyFile Optional String parameter.

Specifies a key pair or a public key to use to sign an assembly. The compiler inserts the public key in the assembly manifest and then signs the final assembly with the private key.
Platform Optional String parameter.

Gets or Sets the Compiler Platform used to generate the output assembly. This parameter can have a value of x86, x64, or anycpu. Default is anycpu.
References Optional String[] parameter.

Specifies the assemblies that are referenced by the types requiring XML serialization.
SdkToolsPath Optional String parameter.

Specifies the path to the SDK tools, such as resgen.exe.
SerializationAssembly Optional ITaskItem[] output parameter.

Contains the generated serialization assembly.
SerializationAssemblyName Optional String parameter.

Specifies the name of the generated serialization assembly.
ShouldGenerateSerializer Required Boolean parameter.

If true, the SGen task should generate a serialization assembly.
Timeout Optional Int32 parameter.

Specifies the amount of time, in milliseconds, after which the task executable is terminated. The default value is Int.MaxValue, indicating that there is no time out period.
ToolPath Optional String parameter.

Specifies the location from where the task will load the underlying executable file (sgen.exe). If this parameter is not specified, the task uses the SDK installation path corresponding to the version of the framework that is running MSBuild.
Types Optional String[] parameter.

Gets or sets a list of specific Types to generate serialization code for. SGen will generate serialization code only for those types.
UseProxyTypes Required Boolean parameter.

If true, the SGen task generates serialization code only for the XML Web service proxy types.

ToolTaskExtension parameters

This task inherits from the ToolTaskExtension class, which inherits from the ToolTask class, which itself inherits from the Task class. This inheritance chain adds several parameters to the tasks that derive from them.

The following table describes the parameters of the base classes:

Parameter Description
EchoOff Optional bool parameter.

When set to true, this task passes /Q to the cmd.exe command line such that the command line does not get copied to stdout.
EnvironmentVariables Optional String array parameter.

Array of environment variable definitions, separated by semicolons. Each definition should specify an environment variable name and value separated by an equal sign. These variables are passed to the spawned executable in addition to, or selectively overriding, the regular environment block. For example, Variable1=Value1;Variable2=Value2.
ExitCode Optional Int32 output read-only parameter.

Specifies the exit code that is provided by the executed command. If the task logged any errors, but the process had an exit code of 0 (success), this is set to -1.
LogStandardErrorAsError Optional bool parameter.

If true, all messages received on the standard error stream are logged as errors.
StandardErrorImportance Optional String parameter.

Importance with which to log text from the standard error stream.
StandardOutputImportance Optional String parameter.

Importance with which to log text from the standard out stream.
Timeout Optional Int32 parameter.

Specifies the amount of time, in milliseconds, after which the task executable is terminated. The default value is Int.MaxValue, indicating that there is no time out period. Time-out is in milliseconds.
ToolExe Optional string parameter.

Projects may implement this to override a ToolName. Tasks may override this to preserve the ToolName.
ToolPath Optional string parameter.

Specifies the location from where the task loads the underlying executable file. If this parameter is not specified, the task uses the SDK installation path that corresponds to the version of the framework that is running MSBuild.
UseCommandProcessor Optional bool parameter.

When set to true, this task creates a batch file for the command line and executes it by using the command-processor instead of executing the command directly.
YieldDuringToolExecution Optional bool parameter.

When set to true, this task yields the node when its task is executing.

See also