#128 MSBuild Task: Property Values Must Be Escaped

open
nobody
Tasks (69)
5
2007-08-08
2007-08-08
Serge Baltic
No

If a property value ends with a backslash, it does not get escaped and goes into the msbuild command line “as is”. As the property value is enclosed in quotes, the closing quote with a backslash is treated as an escaped quote, and the next command-line argument is glued with the property value.

Example:

… <property name="OutDir" value="t:\bin\" /> …
Suppose the command-line like "/p:OutDir=t:\bin\" /p:Something=Else
in this case, the OutDir's value is “t:\bin" /p:Something=Else”, and the “Something” property is not set at all.

Discussion

  • Gerke Geurts
    Gerke Geurts
    2008-01-28

    Logged In: YES
    user_id=707583
    Originator: NO

    Temporary workaround is to add a space at the end of the property value, e.g. <property name="OutDir" value="t:\bin\ " />

     
  • dries
    dries
    2008-12-09

    The problem is that the msbuild task surround the property name and value with quotes while this is not needed. What should happen is escaping the space with %20 and the same should probably happen with the equals sign