I have a fairly complicated installer that I'm writing in Wix that has a lot of custom dialog options based on which components you're installing. Generally, defaults are fine, and thus an unattended install would succeed, but having this customization helps things.
What I'm wondering is, what are best practices in Wix for doing UI conditionals? I've noticed that Wix evaluates all <Publish>
tags, regardless of whether or not the last one evaluated to true, which is leading to a lot of code like this:
<Publish Dialog="Questions" Control="Next" Event="NewDialog" Value="Component1Questions" Order="1">INSTALLCOMPONENT1</Publish>
<Publish Dialog="Questions" Control="Next" Event="NewDialog" Value="Component2Questions" Order="2">NOT INSTALLCOMPONENT1 AND INSTALLCOMPONENT2</Publish>
<Publish Dialog="Questions" Control="Next" Event="NewDialog" Value="Component3Questions" Order="3">NOT INSTALLCOMPONENT1 AND NOT INSTALLCOMPONENT2 AND INSTALLCOMPONENT3</Publish>
<Publish Dialog="Questions" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">NOT INSTALLCOMPONENT1 AND NOT INSTALLCOMPONENT2 AND NOT INSTALLCOMPONENT3</Publish>
And similarly on the "back' sections for each dialog. Is this best practice for this? Is there a way to short circuit evaluation of Publish elements and take the first one that returns true?