Partager via


ProjectElement Class

Definition

Abstract base class for MSBuild construction object model elements.

public ref class ProjectElement abstract : Microsoft::Build::Framework::IProjectElement
public ref class ProjectElement abstract
public abstract class ProjectElement : Microsoft.Build.Framework.IProjectElement
public abstract class ProjectElement
type ProjectElement = class
    interface IProjectElement
type ProjectElement = class
Public MustInherit Class ProjectElement
Implements IProjectElement
Public MustInherit Class ProjectElement
Inheritance
ProjectElement
Derived
Implements

Properties

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.

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.

ConditionLocation

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

ContainingProject

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

ElementName

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

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.

LabelLocation

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

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.

NextSibling

Next sibling element. May be null.

OuterElement

The outer markup associated with this project element.

Parent

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

PreviousSibling

Previous sibling element. May be null.

Methods

Clone()

Returns a shallow clone of this project element.

Clone(ProjectRootElement)

Returns a shallow clone of this project element.

CopyFrom(ProjectElement)

Applies properties from the specified type to 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.

ShouldCloneXmlAttribute(XmlAttribute)

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

Applies to