Project.SetProperty Method
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.
MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Namespace: Microsoft.Build.Evaluation
Assembly: Microsoft.Build (in Microsoft.Build.dll)
Syntax
'Declaration
Public Function SetProperty ( _
name As String, _
unevaluatedValue As String _
) As ProjectProperty
public ProjectProperty SetProperty(
string name,
string unevaluatedValue
)
public:
ProjectProperty^ SetProperty(
String^ name,
String^ unevaluatedValue
)
member SetProperty :
name:string *
unevaluatedValue:string -> ProjectProperty
public function SetProperty(
name : String,
unevaluatedValue : String
) : ProjectProperty
Parameters
name
Type: System.StringThe name of the property to set.
unevaluatedValue
Type: System.StringThe new unevaluated value of the property.
Return Value
Type: Microsoft.Build.Evaluation.ProjectProperty
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.