Compartir a través de


BuildPropertyGroup Class

Definition

This class (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

A BuildPropertyGroup is a collection of BuildProperty objects. This could be represented by a persisted <PropertyGroup> element in the project file, or it could be a virtual collection of properties, such as in the case of global properties, environment variable properties, or the final evaluated properties of a project. These two types of PropertyGroups (persisted and virtual) are handled differently by many of the methods in this class, but in order to reduce the number of concepts for the consumer of the OM, we've merged them into a single class.

public ref class BuildPropertyGroup : System::Collections::IEnumerable
public class BuildPropertyGroup : System.Collections.IEnumerable
type BuildPropertyGroup = class
    interface IEnumerable
Public Class BuildPropertyGroup
Implements IEnumerable
Inheritance
BuildPropertyGroup
Implements

Remarks

Warning

This class (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.Construction Microsoft.Build.Evaluation Microsoft.Build.Execution

Constructors

BuildPropertyGroup()

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Default constructor, that creates an empty virtual (non-persisted) BuildPropertyGroup.

BuildPropertyGroup(Project)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Default constructor, that creates an empty virtual (non-persisted) BuildPropertyGroup.

Properties

Condition

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Accessor for the condition on the property group.

Count

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution Returns the number of properties contained in this BuildPropertyGroup.

IsImported

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This returns a boolean telling you whether this particular property group was imported from another project, or whether it was defined in the main project. For virtual property groups which have no persistence, this is false.

Item[String]

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This is the indexer for the BuildPropertyGroup class, which allows the caller to set or get the property data using simple array indexer [] notation. The caller passes in the property name inside the [], and out comes the BuildProperty object, which can be typecast to a string in order to get just the property value. Or if it's used on the left of the "=" sign, the same notation can set a new BuildProperty object, overwriting. Getting a value requires the property group be virtual.

Methods

AddNewProperty(String, String, Boolean)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Adds a new property to the PropertyGroup, optionally escaping the property value so that it will be treated as a literal.

AddNewProperty(String, String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

The AddNewProperty method adds a new property element to the persisted <PropertyGroup> at the end. This method takes the property name and value as strings directly, so that the BuildProperty object can be created with the correct owner XML document and parent XML element.

Clear()

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Removes all properties and conditions from this BuildPropertyGroup.

Clone(Boolean)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This method creates a copy of the BuildPropertyGroup. A shallow clone will reference the same BuildProperty objects as the original. A deep clone will deep clone the BuildProperty objects themselves. If this is a persisted BuildPropertyGroup, only deep clones are allowed, because you can't have the same XML element belonging to two parents.

GetEnumerator()

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This IEnumerable method returns an IEnumerator object, which allows the caller to enumerate through the BuildProperty objects contained in this BuildPropertyGroup.

RemoveProperty(BuildProperty)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Removes the given BuildProperty object from either a persisted or a virtual BuildPropertyGroup.

RemoveProperty(String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Removes all properties with the given name from either a persisted or a virtual BuildPropertyGroup. For persisted PropertyGroups, there could be multiple. For a virtual BuildPropertyGroup, there can be only one.

SetImportedPropertyGroupCondition(String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Allows setting the condition for imported property groups. Changes will not be persisted.

SetProperty(String, String, Boolean)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Sets a property in this PropertyGroup, optionally escaping the property value so that it will be treated as a literal.

SetProperty(String, String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Sets a property taking the property name and value as strings directly.

Either overrides the value of the property with the given name, or adds it if it doesn't already exist. Setting to the same value as before does nothing.

This method will take into account property precedence rules, so that for example, a reserved MSBuild property cannot be overridden by a normal property.

PropertyGroup must be virtual.

Applies to