mxre / winres

Create and set windows icons and metadata for executables with a rust build script
MIT License
297 stars 42 forks source link

Newlines in XML attributes cause spaces to be deleted - "side-by-side configuration is incorrect" #31

Closed mon closed 3 years ago

mon commented 3 years ago

With a standard manifest entry such as the Common Controls dependency, I spread it over many lines as it is easier to read:

<assemblyIdentity
  type="win32"
  name="Microsoft.Windows.Common-Controls"
  version="6.0.0.0"
  processorArchitecture="*"
  publicKeyToken="6595b64144ccf1df"
  language="*"
/>

However, due to the handling of the XML manifest:

                for line in manf.lines() {
                    writeln!(f, "\"{}\"", escape_string(line.trim()))?;
                }

The whitespace is trimmed and the resulting XML snippet has no whitespace:

<assemblyIdentitytype="win32"name="Microsoft.Windows.Common-Controls"version="6.0.0.0"processorArchitecture="*"publicKeyToken="6595b64144ccf1df"language="*"/>

Understandably, this breaks the build with the error: The application has failed to start because its side-by-side configuration is incorrect.

Ideally, whitespace should be preserved, though I'm not sure if this will break something else which is why this is a bug instead of a PR.

mxre commented 3 years ago

I am not an expert on application manifests and I thought that add each line seperatly to the resource file would cover such an eventuality. I commit a version that adds spaces before and after each line, but I'm unsure if this introduces new bugs in oddly formated files (normaly for XML it should not matter)