Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.19 KB

property-element-msbuild.md

File metadata and controls

77 lines (55 loc) · 2.19 KB
title description ms.date ms.topic dev_langs helpviewer_keywords author ms.author manager ms.subservice
Property Element (MSBuild)
Learn about the MSBuild Property element, which contains a user-defined property name and value that must be specified as a child of a PropertyGroup element.
03/13/2017
reference
VB
CSharp
C++
<Property> Element [MSBuild]
Property Element [MSBuild]
ghogen
ghogen
mijacobs
msbuild

Property element (MSBuild)

Contains a user defined property name and value. Every property used in an MSBuild project must be specified as a child of a PropertyGroup element.

<Project> <PropertyGroup>

Syntax

<Property Condition="'String A' == 'String B'">
    Property Value
</Property>

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
Condition Optional attribute.

Condition to be evaluated. For more information, see Conditions.

Child elements

None.

Parent elements

Element Description
PropertyGroup Grouping element for properties.

Text value

A text value is optional.

This text specifies the property value and may contain XML.

Remarks

Property names are limited to ASCII chars only. Property values are referenced in the project by placing the property name between "$(" and ")". For example, $(builddir)\classes would resolve to build\classes, if the builddir property had the value build. For more information on properties, see MSBuild properties.

Example

The following code sets the Optimization property to false and the DefaultVersion property to 1.0 if the Version property is empty.

<PropertyGroup>
    <Optimization>false</Optimization>
    <DefaultVersion Condition="'$(Version)' == ''" >1.0</DefaultVersion>
</PropertyGroup>

See also