Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK, after some lengthy investigation and lots of trial and error I was able to achieve my goal of launching the default web browser when certain registry entries were not present.</p> <p>I first checked for the required entries in the registries</p> <pre><code>&lt;!--Property that indicates whether .Net framework 4.0 is currently installed--&gt; &lt;Property Id="NETFRAMEWORK40"&gt; &lt;RegistrySearch Id="NetFramework40" Root="HKLM" Key="Software\Microsoft\NET Framework Setup\NDP\v4\Full" Name="Install" Type="raw" /&gt; &lt;/Property&gt; &lt;!--Property that indicates whether 2007 Office Data Connectivity is currently installed--&gt; &lt;Property Id="ODCINSTALLED"&gt; &lt;RegistrySearch Id="CheckODCVersion" Root="HKLM" Key="SOFTWARE\Classes\Installer\Products\000021091D0090400000000000F01FEC" Name="Version" Type="raw" /&gt; &lt;/Property&gt; </code></pre> <p>I then added the WixUtilExtension reference to the project and set the following 3 custom actions up:</p> <pre><code>&lt;CustomAction Id="SetExec1" Property="WixShellExecTarget" Value="http://go.microsoft.com/fwlink/?LinkID=186913" /&gt; &lt;CustomAction Id="SetExec2" Property="WixShellExecTarget" Value="http://www.microsoft.com/downloads/en/details.aspx?familyid=7554f536-8c28-4598-9b72-ef94e038c891&amp;amp;displaylang=en" /&gt; &lt;CustomAction Id="LaunchBrowser" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="ignore" /&gt; </code></pre> <p>The first 2 custom actions are there to set the WixShellExecTarget property that will be used at different times, the last custom action is to launch the default browser using the WixShellExec utility.</p> <p>I then set up 2 custom dialogs for my installer UI, just 2 simple message boxes with a short message and Yes and No buttons. The following is just one of the message boxes as they are both very similar in appearance:</p> <pre><code> &lt;Dialog Id="NetFRWDlg" Width="260" Height="95" Title="[ProductName] Installation" NoMinimize="yes"&gt; &lt;Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="40"&gt; &lt;Text&gt;This setup requires the .NET Framework version 4.0. Please install the .NET Framework and run this setup again. The .NET Framework can be obtained from the web. Would you like to do this now?&lt;/Text&gt; &lt;/Control&gt; &lt;Control Id="YesButton" Type="PushButton" X="72" Y="67" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Yes]"&gt; &lt;Publish Event="DoAction" Value="SetExec1" Order="1"&gt;1&lt;/Publish&gt; &lt;Publish Event="DoAction" Value="LaunchBrowser" Order="2"&gt;1&lt;/Publish&gt; &lt;Publish Event="EndDialog" Value="Exit" Order="3"&gt;1&lt;/Publish&gt; &lt;/Control&gt; &lt;Control Id="NoButton" Type="PushButton" X="132" Y="67" Width="56" Height="17" Default="no" Cancel="yes" Text="[ButtonText_No]"&gt; &lt;Publish Event="EndDialog" Value="Exit"&gt;1&lt;/Publish&gt; &lt;/Control&gt; &lt;Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="[WarningIcon]" /&gt; &lt;/Dialog&gt; </code></pre> <p>I then added these 2 dialogs into the InstallUISequence table:</p> <pre><code> &lt;InstallUISequence&gt; &lt;Show Dialog="NetFRWDlg" After="AppSearch"&gt; (NOT Installed) AND (NOT NETFRAMEWORK40) &lt;/Show&gt; &lt;Show Dialog="ODCDlg" After="AppSearch"&gt; (NOT Installed) AND (NOT ODCINSTALLED) &lt;/Show&gt; &lt;Show Dialog="Install_PAGE1" After="CostFinalize" /&gt; &lt;/InstallUISequence&gt; </code></pre> <p>To give a brief outline of how that all comes together, when the installer is started, it will check for the required registries using the NETFRAMEWORK40 and ODCINSTALLED properties. During the InstallUISequence, the NetFRWDlg or ODCDlg dialog/message boxes will be shown if these registries are missing. The user can then choose to launch the default browser to view the passed in URLs by clicking on the Yes button of the dialog/message box. In doing this, the sequence of actions of setting the WixShellExecTarget property, launching the default browser and exiting the installer carry out. If the user clicks No, then the installer will simply exit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload