Project.SetProperty(String, String) Method

Definition

Sets or adds a property with the given name and value to the project. Overwrites the value of a property with the same name if it did not originate in an imported file.

public:
 Microsoft::Build::Evaluation::ProjectProperty ^ SetProperty(System::String ^ name, System::String ^ unevaluatedValue);
public Microsoft.Build.Evaluation.ProjectProperty SetProperty (string name, string unevaluatedValue);
member this.SetProperty : string * string -> Microsoft.Build.Evaluation.ProjectProperty
Public Function SetProperty (name As String, unevaluatedValue As String) As ProjectProperty

Parameters

name
String

The name of the property to set.

unevaluatedValue
String

The new unevaluated value of the property.

Returns

The property.

Remarks

If there is no property with the given name, updates the last existing property with the given name that has no condition on itself or its property group, unless it originated in an imported file.

Otherwise, adds a new property in the first property group without a condition, creating a property group if necessary after the last existing property group, else at the start of the project.

Evaluation takes place on a best-effort basis. Properties that are defined in the project source following the new property may be used for evaluation. Only this property is evaluated. Other properties that might depend on it are not affected.

Applies to