Be Careful About Formatting WiX XML Files

During the construction of a WiX MSI file, I was getting an error that looked like this

ICE17: Bitmap: '

It took a bit to debug what was causing it. I eventually used the WiX dark tool to decompile the MSI file, then looked for places where it might be referencing a bitmap. This is what I saw in the file (with some attributes removed):

<Control Id="BannerBitmap" Text="&#xD;&#xA;        WixUI_Bmp_Banner&#xD;&#xA;    "/> 
Makes perfect sense what was happening. This is what the XML in the source looked like:

    <String Id="BannerBitmap" Overridable="yes">

What had happened is that I had used Visual Studio to reformat the XML, which inserted Carriage Return/Line Feed (the &#xD;&#xA;) and spacing around the WixUI_Bmp_Banner. When WiX went to write the error into the error file, the first Carriage Return ended the error message, and it lost the rest of the message that had what it was complaining about. It's a bug in the WiX light compiler that it doesn't show the right error message, but perfectly understandable what is happening. All that is needed to fix the error is removing all the formatting.

<String Id="XocReadMeDlgBannerBitmap" Overridable="yes">WixUI_Bmp_Banner</String>

Looking at the output from the dark program shows several places where the formatting has messed up the strings being used in the files. I recommend using dark to find places in your files that might have subtle errors like this. It's important to know that WiX is actually putting all the white space in the MSI files, including Carriage Return/Line Feed and all spaces and tabs that appear in the XML files.

No comments :

Post a Comment