Alexandru
Alexandru

Reputation: 12882

Evaluate conditions before custom actions

I have this action under InstallUISequence:

<Custom Action="WarnIfOutlookNotInstalled" Sequence="1"><![CDATA[NOT Installed]]></Custom>

I also have this condition:

<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="This product requires .NET Framework 4.5 or later."><![CDATA[Installed OR NETFRAMEWORK45]]></Condition>

The custom action named WarnIfOutlookNotInstalled is defined in a custom action DLL which targets .NET 4.0. The problem I have is that, when I run my MSI, it tries to run the WarnIfOutlookNotInstalled custom action before trying to evaluate my above Condition. I need this to be the other way, where it must evaluate the condition before the custom action, because if .NET 4 is not installed, it fails completely, and presents the user with my fatal error screen which says that, "The installer was interrupted before it could be installed. You need to restart the installer to try again." How can I get around this problem?

Upvotes: 0

Views: 151

Answers (1)

Bogdan Mitrache
Bogdan Mitrache

Reputation: 10993

A custom actions gets executed at a certain step during the installation, depending on where you schedule it.

In your case, you need to schedule the custom action to be executed after the standard action "LaunchConditions". By adding something like this in < InstalUISequence >:

  <Custom Action="WarnIfOutlookNotInstalled" After="LaunchConditions"><![CDATA[NOT Installed]]></Custom>

Upvotes: 1

Related Questions