Partilhar via


WriteCodeFragment Class

Definition

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

public ref class WriteCodeFragment : Microsoft::Build::Tasks::TaskExtension
public class WriteCodeFragment : Microsoft.Build.Tasks.TaskExtension
type WriteCodeFragment = class
    inherit TaskExtension
Public Class WriteCodeFragment
Inherits TaskExtension
Inheritance
WriteCodeFragment

Constructors

WriteCodeFragment()

Creates a temporary code file with the specified generated code fragment.

Properties

AssemblyAttributes

Description of attributes to write. Item include is the full type name of the attribute. For example, "System.AssemblyVersionAttribute". Each piece of metadata is the name-value pair of a parameter, which must be of type System.String. Some attributes only allow positional constructor arguments, or the user may just prefer them. To set those, use metadata names like "_Parameter1", "_Parameter2" etc. If a parameter index is skipped, it's an error.

BuildEngine

The build engine automatically sets this property to allow tasks to call back into it.

(Inherited from Task)
BuildEngine2

The build engine automatically sets this property to allow tasks to call back into it. This is a convenience property so that task authors inheriting from this class do not have to cast the value from IBuildEngine to IBuildEngine2.

(Inherited from Task)
BuildEngine3

Retrieves the IBuildEngine3 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine4

Retrieves the IBuildEngine4 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine5

Retrieves the IBuildEngine5 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine6

Retrieves the IBuildEngine6 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine7

Retrieves the IBuildEngine7 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine8

Retrieves the IBuildEngine8 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine9

Retrieves the IBuildEngine9 version of the build engine interface provided by the host.

(Inherited from Task)
HelpKeywordPrefix

Gets or sets the prefix used to compose help keywords from string resource names. If a task does not have help keywords associated with its messages, it can ignore this property or set it to null. If the prefix is set to an empty string, then string resource names will be used verbatim as help keywords. For an example of how this prefix is used, see the TaskLoggingHelper.LogErrorWithCodeFromResources(string, object[]) method.

(Inherited from Task)
HostObject

The build engine sets this property if the host IDE has associated a host object with this particular task.

(Inherited from Task)
Language

Language of code to generate. Language name can be any language for which a CodeDom provider is available. For example, "C#", "VisualBasic". Emitted file will have the default extension for that language.

Log

This API supports the product infrastructure and is not intended to be used directly from your code.

Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.

(Inherited from TaskExtension)
OutputDirectory

Destination folder for the generated code. Typically the intermediate folder.

OutputFile

The path to the file that was generated. If this is set, and a file name, the destination folder will be prepended. If this is set, and is rooted, the destination folder will be ignored. If this is not set, the destination folder will be used, an arbitrary file name will be used, and the default extension for the language selected.

TaskResources

Gets or sets the task's culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings.

(Inherited from Task)

Methods

Execute()

Main entry point.

Applies to