[wix-users] Fwd: WiX Error Handling

Christopher Painter chrpai at iswix.com
Thu Jan 10 15:22:53 PST 2019

Take a look at :


Another good thing to take an MSI that's already built or build one using the WiXUI  extension and look at it in ORCA to see how it's constructed.  Then translate that back to WXS speak.

From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Todd Hoatson via wix-users <wix-users at lists.wixtoolset.org>
Sent: Thursday, January 10, 2019 5:12 PM
To: wix-users at lists.wixtoolset.org
Cc: Todd Hoatson
Subject: [wix-users] Fwd: WiX Error Handling

I would like to implement a fatal error dialog, as described in WiX 3.6: A
Developer's Guide to Windows Installer XML, Chapter 6. Adding a User

Here's the code I have:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
      <Dialog Id="FatalErrorDlg" Width="370" Height="270" Title="Amazing
        <Control Id="Description" Type="Text" X="50" Y="70" Width="220"
                 Text="[DISPLAYNAME] Setup Wizard ended prematurely because
of the following error: [ERRMSG]  Your system has not been modified. To
install this program at a later time, run Setup Wizard again." />
        <Control Id="Finish" Type="PushButton" X="180" Y="243"
                 Width="56" Height="17" Default="yes" Cancel="yes"
          <Publish Event="EndDialog" Value="Exit" />

The above code is in its own file:  FatalErrDlg.wxs.

Then, in my main wix file, I have the following:

    <Show Dialog="FatalErrorDlg" OnExit="error" />
    <Custom Action="SetDefProjFolder" After="FindRelatedProducts"></Custom>
  <Custom Action="VerifyProjectPath" After="SetDefProjFolder"></Custom>
  <Custom Action="UseDefProjFolder" After="AppSearch">NOT
  <Custom Action="UseRegProjFolder"

(It wasn't clear to me from the book example where to put the dialog within
the install sequence, so I just put it above the custom actions.  The idea
is to use the dialog to report errors that occur in the custom actions, by
having those actions set the value of the property ERRMSG.)

In one of the custom actions, I have the following code:

  session["ERRMSG"] = "Problem encountered...";
  return ActionResult.Failure;

(This is to force an error, so I can test the error dialog.)  The problem
that I have is that the error causes the installer to stop, but never
displays the FatalErrorDlg.

Can anyone suggest what I'm missing?

Todd Hoatson

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list