Wix installer - Can I execute launch conditions by parts?

304 views Asked by At

I am using WiX 3.10. I have a particular scenario where there are some custom actions occurring before the launch conditions because during the launch conditions, I evaluate certain properties that are set during those custom actions. However, during launch conditions, I also have to check the version of .Net framework. The problem is that if I don't have the required .Net Framework, the custom action executes before it reaches the launch condition and the message is not displayed to the user.

Can I execute launch conditions in a specific order or do I have to change the custom action to execute AFTER launch conditions? I need help. Not an expert in WiX.

Code for reference:

<!--Need to execute this first-->
    <PropertyRef Id="NETFRAMEWORK35" />
      <PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
      <Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
        <![CDATA[Installed OR (NETFRAMEWORK35 = "#1" AND WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED)]]>
      </Condition>

<!--Need to execute this second.  It is execute first through custom action-->
      <PropertyRef Id="SQLSERVERMISSINGREQUIREDSERVICES"/>
      <Condition Message="Please install the following SQL Server services for the SQL Server instance: [SQLSERVERMISSINGREQUIREDSERVICES]. Then run this installer again.">
        <![CDATA[Installed or NOT SQLSERVERMISSINGREQUIREDSERVICES]]>
      </Condition>

<!--Need to execute this third. It is execute second through custom action-->
      <PropertyRef Id="SQLSERVERMAJORVERSION"/>
      <PropertyRef Id="SQLSERVERMINORVERSION" />
      <Condition Message="The GSL server requires a 2008 R2, 2012, or 2014 instance named 'GSLSQL' to be installed on the local server.">
        <![CDATA[Installed OR (SQLSERVERMAJORVERSION = "#10" AND SQLSERVERMINORVERSION >= "#50") OR SQLSERVERMAJORVERSION = "#11" OR SQLSERVERMAJORVERSION = "#12"]]>
      </Condition>
1

There are 1 answers

0
PhilDW On

The general way to sequence this type of condition is to replace the launch conditions with type 19 custom actions, as suggested in the LaunchCondition documentation. This is used with an error message in the Error table describing the error, and the CA itself is conditioned on the property values.