[wix-users] Fwd: WiX Error Handling

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


Take a look at :


https://docs.microsoft.com/en-us/windows/desktop/msi/installuisequence-table



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
Interface.

Here's the code I have:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Fragment>
    <UI>
      <Dialog Id="FatalErrorDlg" Width="370" Height="270" Title="Amazing
Software">
        <Control Id="Description" Type="Text" X="50" Y="70" Width="220"
Height="80"
                 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"
Text="Finish">
          <Publish Event="EndDialog" Value="Exit" />
        </Control>
      </Dialog>
    </UI>
  </Fragment>
</Wix>

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

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

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

(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?

thanks,
Todd Hoatson

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



More information about the wix-users mailing list