Msbuild exec and curl: Quoting nightmare Msbuild exec and curl: Quoting nightmare curl curl

Msbuild exec and curl: Quoting nightmare


The problem is:

  1. Msbuild replaces %20 with whitespace
  2. Even if you escape the percent sign using either %2520 or &37;20, cmd.exe will replace %2 with an empty string, such that a 0 remains on the command line.

So the solution is:

<PropertyGroup>    <SourceURL>http://www.example.com/url%25%2520with%25%2520spaces</SourceURL></PropertyGroup>

Aaaargh. Anyone who doesn't get a headache from such an elaborate escape sequence?


You need to escape the & sign as well:

<SourceURL>http://www.example.com/url%2520with%2520spaces</SourceURL>