Partilhar via


ProjectTaskElement Class

Definition

ProjectTaskElement represents the Task element in the MSBuild project.

public ref class ProjectTaskElement : Microsoft::Build::Construction::ProjectElementContainer
public class ProjectTaskElement : Microsoft.Build.Construction.ProjectElementContainer
type ProjectTaskElement = class
    inherit ProjectElementContainer
Public Class ProjectTaskElement
Inherits ProjectElementContainer
Inheritance

Properties

AllChildren

Get an enumerator over all descendants in a depth-first manner.

(Inherited from ProjectElementContainer)
AllParents

All parent elements of this element, going up to the ProjectRootElement. None if this itself is a ProjectRootElement. None if this itself has not been attached to a parent yet.

(Inherited from ProjectElement)
Children

Get enumerable over all the children

(Inherited from ProjectElementContainer)
ChildrenReversed

Get enumerable over all the children, starting from the last

(Inherited from ProjectElementContainer)
Condition

Gets or sets the Condition value. It will return empty string IFF a condition attribute is legal but it’s not present or has no value. It will return null IFF a Condition attribute is illegal on that element. Removes the attribute if the value to set is empty. It is possible for derived classes to throw an InvalidOperationException if setting the condition is not applicable for those elements.

(Inherited from ProjectElement)
ConditionLocation

Location of the "Condition" attribute on this element, if any. If there is no such attribute, returns null.

(Inherited from ProjectElement)
ContainingProject

ProjectRootElement (possibly imported) that contains this Xml. Cannot be null.

(Inherited from ProjectElement)
ContinueOnError

Gets or sets the continue on error value. Returns empty string if it is not present. Removes the attribute if the value to set is empty.

ContinueOnErrorLocation

Location of the "ContinueOnError" attribute on this element, if any. If there is no such attribute, returns null;

Count

Number of children of any kind

(Inherited from ProjectElementContainer)
ElementName

Gets the name of the associated element. Useful for display in some circumstances.

(Inherited from ProjectElement)
FirstChild

First child, if any, otherwise null. Cannot be set directly; use PrependChild().

(Inherited from ProjectElementContainer)
Label

Gets or sets the Label value. Returns empty string if it is not present. Removes the attribute if the value to set is empty.

(Inherited from ProjectElement)
LabelLocation

Location of the "Label" attribute on this element, if any. If there is no such attribute, returns null;

(Inherited from ProjectElement)
LastChild

Last child, if any, otherwise null. Cannot be set directly; use AppendChild().

(Inherited from ProjectElementContainer)
Location

Location of the corresponding Xml element. May not be correct if file is not saved, or file has been edited since it was last saved. In the case of an unsaved edit, the location only contains the path to the file that the element originates from.

(Inherited from ProjectElement)
MSBuildArchitecture

Gets or sets the architecture value for the task. Returns empty string if it is not present. Removes the attribute if the value to set is empty.

MSBuildArchitectureLocation

Location of the "MSBuildArchitecture" attribute on this element, if any. If there is no such attribute, returns null;

MSBuildRuntime

Gets or sets the runtime value for the task. Returns empty string if it is not present. Removes the attribute if the value to set is empty.

MSBuildRuntimeLocation

Location of the "MSBuildRuntime" attribute on this element, if any. If there is no such attribute, returns null;

Name

Gets the task name

NextSibling

Next sibling element. May be null.

(Inherited from ProjectElement)
OuterElement

The outer markup associated with this project element.

(Inherited from ProjectElement)
Outputs

Gets any output children.

ParameterLocations

Enumerable over the locations of parameters on the task. Condition and ContinueOnError, which have their own properties, are not included in this collection. If parameters differ only by case only the last one will be returned. MSBuild uses only this one. Hosts can still remove the other parameters by using RemoveAllParameters().

Parameters

Enumerable over the unevaluated parameters on the task. Attributes with their own properties, such as ContinueOnError, are not included in this collection. If parameters differ only by case only the last one will be returned. MSBuild uses only this one. Hosts can still remove the other parameters by using RemoveAllParameters().

Parent

Null if this is a ProjectRootElement. Null if this has not been attached to a parent yet.

(Inherited from ProjectElement)
PreviousSibling

Previous sibling element. May be null.

(Inherited from ProjectElement)

Methods

AddOutputItem(String, String, String)

Convenience method to add a conditioned Output Item to this task. Adds after the last child.

AddOutputItem(String, String)

Convenience method to add an Output Item to this task. Adds after the last child.

AddOutputProperty(String, String, String)

Convenience method to add a conditioned Output Property to this task. Adds after the last child.

AddOutputProperty(String, String)

Convenience method to add an Output Property to this task. Adds after the last child.

AppendChild(ProjectElement)

Inserts the provided element as the last child. Throws if the parent is not itself parented. Throws if the node to add is already parented. Throws if the node to add was created from a different project than this node.

(Inherited from ProjectElementContainer)
Clone()

Returns a shallow clone of this project element.

(Inherited from ProjectElement)
Clone(ProjectRootElement)

Returns a shallow clone of this project element.

(Inherited from ProjectElement)
CopyFrom(ProjectElement)

Applies properties from the specified type to this instance.

CopyFrom(ProjectElement)

Applies properties from the specified type to this instance.

(Inherited from ProjectElement)
CreateNewInstance(ProjectRootElement)

Returns a new instance of this same type. Any properties that cannot be set after creation should be set to copies of values as set for this instance.

CreateNewInstance(ProjectRootElement)

Returns a new instance of this same type. Any properties that cannot be set after creation should be set to copies of values as set for this instance.

(Inherited from ProjectElement)
DeepClone(ProjectRootElement, ProjectElementContainer)

Returns a clone of this project element and all its children.

(Inherited from ProjectElementContainer)
DeepCopyFrom(ProjectElementContainer)

Applies properties from the specified type to this instance.

(Inherited from ProjectElementContainer)
GetParameter(String)

Gets the value of the parameter with the specified name, or empty string if it is not present.

InsertAfterChild(ProjectElement, ProjectElement)

Insert the child after the reference child. Reference child if provided must be parented by this element. Reference child may be null, in which case this is equivalent to PrependChild(child). Throws if the parent is not itself parented. Throws if the reference node does not have this node as its parent. Throws if the node to add is already parented. Throws if the node to add was created from a different project than this node.

(Inherited from ProjectElementContainer)
InsertBeforeChild(ProjectElement, ProjectElement)

Insert the child before the reference child. Reference child if provided must be parented by this element. Reference child may be null, in which case this is equivalent to AppendChild(child). Throws if the parent is not itself parented. Throws if the reference node does not have this node as its parent. Throws if the node to add is already parented. Throws if the node to add was created from a different project than this node.

(Inherited from ProjectElementContainer)
PrependChild(ProjectElement)

Inserts the provided element as the first child. Throws if the parent is not itself parented. Throws if the node to add is already parented. Throws if the node to add was created from a different project than this node.

(Inherited from ProjectElementContainer)
RemoveAllChildren()

Remove all the children, if any.

(Inherited from ProjectElementContainer)
RemoveAllParameters()

Removes all parameters from the task. Does not remove any "special" parameters: ContinueOnError, Condition, etc.

RemoveChild(ProjectElement)

Removes the specified child. Throws if the child is not currently parented by this object. This is O(1). May be safely called during enumeration of the children.

(Inherited from ProjectElementContainer)
RemoveParameter(String)

Removes any parameter on this task with the specified name. If there is no such parameter, does nothing.

SetParameter(String, String)

Adds (or modifies the value of) a parameter on this task

ShouldCloneXmlAttribute(XmlAttribute)

Hook for subclasses to specify whether the given attribute should be cloned or not

(Inherited from ProjectElement)

Applies to