Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Reference
MSBuild
MSBuild Concepts
Overview
 How To: Escape Special Characters i...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio
How To: Escape Special Characters in MSBuild

Certain characters have special meaning in MSBuild project files. Examples of the characters include semicolons (;) and asterisks (*). In order to use these special characters as literals in a project file, they must be specified with the syntax %xx, where xx represents the ASCII hexadecimal value of the character. For a complete list of ASCII characters and their hexadecimal values, see ASCII Character Codes.

MSBuild Special Characters

One example of where special characters are used is in the Include attribute of item collections. For example, the following item collection declares two items: MyFile.cs and MyClass.cs.

<Compile Include="MyFile.cs;MyClass.cs"/>

If you want to declare an item that contains a semicolon in the name, you need to use the %xx syntax to escape the semicolon and prevent MSBuild from declaring two separate items. For example, the following item escapes the semicolon and declares one item named MyFile.cs;MyClass.cs.

<Compile Include="MyFile.cs%3BMyClass.cs"/>

To use an MSBuild special character as a literal character

  • Use the notation %xx in place of the special character, where xx represents the hexadecimal value of the ASCII character. For example, to use an asterisk (*) as a literal character, you would use the value %2A.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker