tags:

views:

51

answers:

1

I need to include a single quote in an item transformation, like so:

<DatabaseFileNames>@(DatabaseFiles->'%(PhysicalName)', '','')</DatabaseFileNames>

This, however, spits out a rather cryptic error:

error MSB4095: The item metadata %(PhysicalName) is being referenced without an item name. Specify the item name by using %(itemname. PhysicalName).

I'm basically trying to create a comma-seperated list of single-quoted values.

How do I get single-quotes into the transformation seperator?

I tried using HTML-entities (the entity for single quote is &#39;), like so:

<DatabaseFileNames>@(DatabaseFiles->'%(PhysicalName)', '&#39;,&#39;')</DatabaseFileNames>

But I get the same error.

+1  A: 

It looks like you have to use URL-encoding style escapes, that is, %CharacterHexNumber. In this case, the single quote is ASCII character 39, which is 27 in hex, so the correct escape sequence is:

<DatabaseFileNames>@(DatabaseFiles->'%(PhysicalName)', '%27,%27')</DatabaseFileNames>
splattered bits