wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

Error code 2804 after upgrading to WiX 4 #8018

Open pfusik opened 6 months ago

pfusik commented 6 months ago

WiX Version

4.0.4

.NET or MSBuild or Visual Studio Version

8.0.200

HeatWave Version

building from command line

Windows Version

Win11 23H2

Repro Repo

No response

Repro Steps

  1. I recently migrated my project from WiX 3: https://sourceforge.net/p/recoil/code/ci/57ecb0d952302e1dea71b521c9988b83df9664ae/
  2. Open recoil-6.4.1-win64.msi from https://sourceforge.net/projects/recoil/files/recoil/6.4.1/
  3. Click Next, I Accept, Next

Actual Result

3. image image

Expected Result

  1. Installation succeeds

Acknowledgements

pfusik commented 6 months ago

This is also affecting my other project: https://asap.sourceforge.net

pfusik commented 6 months ago

The problem was with the following code:

        <?define MUTEXCONDS=(($recoilwin.ext=3 OR ($recoilwin.ext=-1 AND ?recoilwin.ext=3)) AND ($xnview_recoil.ext=3 OR ($xnview_recoil.ext=-1 AND ?xnview_recoil.ext=3)));
(($recoilwin.ext=3 OR ($recoilwin.ext=-1 AND ?recoilwin.ext=3)) AND ($xnviewmp64.ext=3 OR ($xnviewmp64.ext=-1 AND ?xnviewmp64.ext=3) OR $imagine.ext=3 OR ($imagine.ext=-1 AND ?imagine.ext=3)));
(($recoilwin.ext=3 OR ($recoilwin.ext=-1 AND ?recoilwin.ext=3)) AND ($imagine64.ext=3 OR ($imagine64.ext=-1 AND ?imagine64.ext=3)));
(($xnview_recoil.ext=3 OR ($xnview_recoil.ext=-1 AND ?xnview_recoil.ext=3)) AND ($xnviewmp64.ext=3 OR ($xnviewmp64.ext=-1 AND ?xnviewmp64.ext=3)));
(($xnview_recoil.ext=3 OR ($xnview_recoil.ext=-1 AND ?xnview_recoil.ext=3)) AND ($imagine.ext=3 OR ($imagine.ext=-1 AND ?imagine.ext=3)));
(($xnview_recoil.ext=3 OR ($xnview_recoil.ext=-1 AND ?xnview_recoil.ext=3)) AND ($imagine64.ext=3 OR ($imagine64.ext=-1 AND ?imagine64.ext=3)));
(($xnviewmp64.ext=3 OR ($xnviewmp64.ext=-1 AND ?xnviewmp64.ext=3)) AND ($imagine.ext=3 OR ($imagine.ext=-1 AND ?imagine.ext=3) OR $imagine64.ext=3 OR ($imagine64.ext=-1 AND ?imagine64.ext=3)));
(($imagine.ext=3 OR ($imagine.ext=-1 AND ?imagine.ext=3)) AND ($imagine64.ext=3 OR ($imagine64.ext=-1 AND ?imagine64.ext=3)))?>
        ...
        <?foreach MUTEXCOND in $(var.MUTEXCONDS)?>
            <Publish Dialog="MyCustomizeDlg" Control="Next" Event="SpawnDialog" Value="MyManyAssociationsDlg" Order="3" Condition="$(var.MUTEXCOND)" />
        <?endforeach?>

Removing the newlines from the MUTEXCONDS define avoids the runtime error.

pfusik commented 6 months ago

It's not a problem with <?define. In my other project the newlines were directly in <?foreach.

barnson commented 6 months ago

MSI doesn't like the extraneous newlines. This error is caught by running validation (wix msi validate if you're building with wix.exe) so taking this out of WiX v5 in favor of deeper parser thinking (e.g,. GetAttributeCondition).