MSBuild Special Characters


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

MSBuild reserves some characters for special use in specific contexts. You only have to escape such characters if you want to use them literally in the context in which they are reserved. For example, an asterisk has special meaning only in the Include and Exclude attributes of an item definition, and in calls to CreateItem. If you want an asterisk to appear as an asterisk in one of those contexts, you must escape it. In every other context, just type the asterisk where you want it to appear.

To escape a special character, use the syntax %xx, where xx represents the ASCII hexadecimal value of the character. For more information, see How to: Escape Special Characters in MSBuild.

The following table lists MSBuild special characters:

CharacterASCIIReserved Usage
%%25Referencing metadata
$%24Referencing properties
@%40Referencing item lists
'%27Conditions and other expressions
;%3BList separator
?%3FWildcard character for file names in Include and Exclude attributes
*%2AWildcard character for use in file names in Include and Exclude attributes

Advanced Concepts