WriteCodeFragment Task

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Generates a temporary code file from the specified generated code fragment. Does not delete the file.

Parameters

The following table describes the parameters of the WriteCodeFragment task.

Parameter Description
AssemblyAttributes Optional ITaskItem[] parameter.

Description of the attributes to write. The item Include value is the full type name of the attribute, for example, "System.AssemblyVersionAttribute".

Each metadata is the name-value pair of a parameter, which must be of type String. Some attributes only allow positional constructor arguments. However, you can use such arguments in any attribute. To set positional constructor attributes, use metadata names that resemble "_Parameter1", "_Parameter2", and so on.

A parameter index cannot be skipped.
Language Required String parameter.

Specifies the language of the code to generate.

Language can be any language for which a CodeDom provider is available, for example, "C#" or "VisualBasic". The emitted file will have the default file name extension for that language.
OutputDirectory Optional ITaskItem parameter.

Specifies the destination folder for the generated code, typically the intermediate folder.
OutputFile Optional ITaskItem output parameter.

Specifies the path of the file that was generated. If this parameter is set by using a file name, the destination folder is prepended to the file name. If it is set by using a root, the destination folder is ignored.

If this parameter is not set, the output file name is the destination folder, an arbitrary file name, and the default file name extension for the specified language.

Remarks

In addition to having the parameters that are listed in the table, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension Base Class.

See Also

Tasks
Task Reference