IT:AD:WiX:HowTo:Create pre-launch Conditions
#
Why
It's rather useful to check the target environment before even bothering with an install. The two most common prechecks are
Does the target have the right OS? Does the target have the right .NET Framework? One way to do that is with the use of Condition element.
Process
Placement
Conditions change behavior depending on where they are placed:
<Component|Control|Feature|Product>
Component> `Condition`: becomes a Condition of the Component.
*
Control> `Condition`: becomes ControlCondition entry.
*
Feature
> `COndition`: becomes a Condition entry.
*
Product
> `Condition`: becomes a LaunchCondition entry.
For example, a couple of Conditions placed under the Product element:
<Product …
>
...
<!-- Launch conditions -->
<Condition Message="This application is only supported on Windows Vista,
Server 2008, or higher (32 or 64 bit).">
<![CDATA[Installed OR (VersionNT >= 600) OR (VersionNT64 >=600)]]>
</Condition>
<Condition Message="This application is only supported on Windows Vista,
Server 2008 (32 or 64 bit).">
<![CDATA[Installed OR (VersionNT < 700) OR (VersionNT64 < 700)]]>
</Condition>
</Product>
Common Conditions
#### Platform Check is WS2008+ or Vista, 32 or 64bit ####
<Component|Control|Feature|Product> <Condition Message=“This application is only supported on Windows Vista, Server 2008, or higher (32 or 64 bit).”
>
<![CDATA[Installed OR (VersionNT >= 600) OR (VersionNT64 >=600)]]>
</Condition>
</Component|Control|Feature|Product>