Simple Conditions

When you are building, you often have to make decisions based on conditions. MSBuild allows almost every XML element to contain a conditional statement within it. The statement would be declared in the Condition attribute. If this attribute evaluates to false, then the element and its entire child elements are ignored. In the sample Visual Studio project that was shown at the end of the previous section, you will find the statement <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>. In this declaration the condition is checking to see if the property is empty. If so, then it will be defined; otherwise the statement will be skipped. This is a method to provide a default overridable value for a property. ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.