Is there a way to use value ending with space as XmlPoke value? When I execute task, value is replaced but without space at the end.
Reproduction:
test.targets:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<Copy SourceFiles="test.xml" DestinationFiles="output.xml"/>
<XmlPoke Query="/root/element/@attr[.='replaceme']|/root/replaceme" Value="X " XmlInputPath="output.xml"/>
</Target>
</Project>
test.xml:
<root>
<element attr="replaceme" />
<replaceme/>
</root>
When I run:
MSBuild /v:detailed test.targets
I get output.xml without space:
<root>
<element attr="X" />
<replaceme>X</replaceme>
</root>
Is there a way to force XmlPoke to set correct value (with space at the end)?
Value is an MSBuild "Item" Usually, items represent file paths and MSBuild treats these in a special (undercover) way.
So, the issue is not related to XML escaping but to MSBuild item escaping. This is how you can force the space character:
<XmlPoke ... Value="X%20" ... />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With