Search code examples
wixwindows-installerwix3

Character %20 escaping when using Exec Command in .wixproj file


Git command is used in BeforeBuild section of a WiX project. URL used contains character %20, that is replaced by space during build process.

<Target Name="BeforeBuild">
  <Exec Command='git clone "https://example.url.com/My%20Project/Repo"' />

Cloning works fine when used on command line, but not when used in WiX project, because a space in URL.


Solution

  • I solved this problem eventually. Normally char % would be used to escape another % char and it will also work in this case, but all characters must be URL encoded when using Command in WiX project.

    <Target Name="BeforeBuild">
      <Exec Command='git clone "https://example.url.com/My%25%25%32%30Project/Repo"' />