How to: Escape Special Characters in MSBuild Home
This page is specific to:.NET Framework Version:2.03.03.54.0
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 by using the syntax %xx, where xx represents the ASCII hexadecimal value of the character.

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 must 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, use the value %2A.

See Also

Concepts

Other Resources

Community Content

ASCII Character Codes
Added by:Sayed Ibrahim Hashimi
You can find the ASCII Character Codes at http://msdn.microsoft.com/en-us/library/4z4t9ed1(VS.80).aspx.

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View