Skip to content

Latest commit

 

History

History
73 lines (55 loc) · 2.26 KB

File metadata and controls

73 lines (55 loc) · 2.26 KB
title PropertyGroup Element (MSBuild)
description Learn about the MSBuild PropertyGroup element, which contains a set of user-defined Property elements.
ms.date 03/13/2017
ms.topic reference
f1_keywords
dev_langs
VB
CSharp
C++
helpviewer_keywords
<PropertyGroup> element [MSBuild]
PropertyGroup element [MSBuild]
author ghogen
ms.author ghogen
ms.subservice msbuild

PropertyGroup element (MSBuild)

Contains a set of user-defined Property elements. Every Property element used in an MSBuild project must be a child of a PropertyGroup element.

<Project> <PropertyGroup>

Syntax

<PropertyGroup Condition="'String A' == 'String B'">
    <Property1>...</Property1>
    <Property2>...</Property2>
</PropertyGroup>

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

Element Description
Property Optional element.

A user defined property name, which contains the property value. There may be zero or more Property elements in a PropertyGroup element.

Parent elements

Element Description
Project Required root element of an MSBuild project file.

Example

The following code example shows how to set properties based on a condition. In this example, if the value of the CompileConfig property is DEBUG, the Optimization, Obfuscate, and OutputPath properties inside of the PropertyGroup element are set.

<PropertyGroup Condition="'$(CompileConfig)' == 'DEBUG'" >
    <Optimization>false</Optimization>
    <Obfuscate>false</Obfuscate>
    <OutputPath>$(OutputPath)\debug</OutputPath>
</PropertyGroup>

See also