Freigeben über


ProjectRootElement.AddProperty Method

Updates or adds a property to this project.

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.Construction
Assembly:  Microsoft.Build (in Microsoft.Build.dll)

Syntax

'Declaration
Public Function AddProperty ( _
    name As String, _
    value As String _
) As ProjectPropertyElement
public ProjectPropertyElement AddProperty(
    string name,
    string value
)
public:
ProjectPropertyElement^ AddProperty(
    String^ name, 
    String^ value
)
member AddProperty : 
        name:string * 
        value:string -> ProjectPropertyElement
public function AddProperty(
    name : String, 
    value : String
) : ProjectPropertyElement

Parameters

  • name
    Type: System.String

    The name of the property to be updated or added.

  • value
    Type: System.String

    The value of the property to be updated or added.

Return Value

Type: Microsoft.Build.Construction.ProjectPropertyElement
Returns the updated or added property.

Remarks

Updates the last existing property with the specified name that has no Condition attribute on itself or on the property group that contains it. Otherwise, creates a property and adds it to the first property group that has no Condition attribute. If no such property group exists, creates a property group after the last existing property group, if any, and adds the property to it . Otherwise, creates and adds a property group to the start of the project, and adds the property to it.

.NET Framework Security

See Also

Reference

ProjectRootElement Class

Microsoft.Build.Construction Namespace