Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't understand WiX conditions boolean logic

Tags:

wix

In order to check if .NET framework is installed you can use this condition:

<Condition Message="This application requires .NET Framework">
    <![CDATA[Installed OR NETFRAMEWORK20]]>
</Condition>

I don't understand why the two sub-conditions (Installed, NETFRAMEWORK20) are combined with an OR operator, rather I would expect something like this where both conditions are combined with an AND:

<![CDATA[Installed AND NOT NETFRAMEWORK20]]>

Where is my misunderstanding?

like image 483
nabulke Avatar asked Jul 16 '11 08:07

nabulke


1 Answers

Because the <Condition> element is a condition for the installer to continue (and the message is only used if the condition fails).

So, we want to continue running this installation if either:

  1. This package is already installed. We're performing some other action (say, removal), and we don't need to check any other conditions, or,
  2. (Because the first condition wasn't true) We're specifically running to install the package, and we've detected that .NET Framework 2.0 (or better) is installed.

If the <Condition> was just NETFRAMEWORK20, and someone had just uninstalled .NET Framework, and then tried to uninstall your package, the condition would fail and display the message "This application requires .NET Framework" - which would be very annoying.

like image 108
Damien_The_Unbeliever Avatar answered Oct 19 '22 19:10

Damien_The_Unbeliever