the following msbuild Exec statement
<Exec Command="curl.exe -f -O --url "$(SourceURL)"">
fails if SourceURL contains spaces. Even if I try
<PropertyGroup>
<SourceURL>http://www.example.com/url%20with%20spaces</SourceURL>
</PropertyGroup>
or even
<PropertyGroup>
<SourceURL>http://www.example.com/url&37;20with&37;20spaces</SourceURL>
</PropertyGroup>
msbuild automagically translates any of this to spaces (can you believe that?) and curl tries to fetch http://www.example.com/url, which yields a 404 error.
I do not understand why. Did I not properly quote the URL argument?
[update] On a command prompt, the following works:
curl.exe -f -O --url "http://www.example.com/url%20with%20spaces"
while this doesn’t:
curl.exe -f -O --url "http://www.example.com/url with spaces"
So my question really boils down to: how do I prevent msbuild from replacing %20 with whitespace?
cheers
Hendrik
(Using curl 7.21.7 (i386-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5 and msbuild 3.5.30729.1 on Windows 7)
The problem is:
%20with whitespace%2520or&37;20, cmd.exe will replace%2with an empty string, such that a 0 remains on the command line.So the solution is:
Aaaargh. Anyone who doesn’t get a headache from such an elaborate escape sequence?