In general, this works well for Immediate custom actions (my custom actions follow a similar pattern).
However, for deferred actions, you're not going to be able to set (or get) properties. That being said, logging still generally works. The caveat is that custom actions hooked to DoAction in the UI aren't going to log very much. But I work hard to NOT put any deferred actions in my UI. I also try to make my deferred actions as simple and as short as I can manage. The quality of log messages is up to you. I prefer NOT to dump the exception stack trace in a dialog or log message unless I absolutely have to. Particularly if the user is going to see It, I try to give a message appropriate to the context with a "Details" button that displays the stack trace. -- John Merryweather Cooper Build & Install Engineer - ESA Jack Henry & Associates, Inc.® Shawnee Mission, KS 66227 Office: 913-341-3434 x791011 jocoo...@jackhenry.com www.jackhenry.com -----Original Message----- From: Steven Ogilvie [mailto:steven.ogil...@titus.com] Sent: Friday, May 9, 2014 2:27 PM To: General discussion about the WiX toolset. Subject: Re: [WiX-users] Displaying custom error messages if deferred CA fails [P] Classification: Public 1. Have a MSI property set up that is empty If the custom action has an error populate the MSI property Display the error via a custom error dialog if the property is not empty? 2. Display the custom action error message in the Custom Action itself (as long as the MSI is not running silently) i.e.: [CustomAction] Public static ActionResult BackupMyDatabase(Session session) { Try { If (session == null} { Throw new ArgumentNullException("session"); } // code to backup db } catch (Exception ex) { if (session != null) { session.Log("BackupMyDatabase failed: "); if (ex != null) { session.Log("Exception:"); session.Log(ex.Message); } session.Message( InstallMessage.User + (int)MessageBoxIcon.Error + (int)MessageBoxButtons.OK, new Record { FormatString = "Setup could not back up the database: \nException: " + ex.Message }); } return ActionResult.Failure; } if (session != null) { Session.Log("BackupMyDatabase succeeded..."); } return ActionResult.Success; } -----Original Message----- From: Soren Dreijer [mailto:dreijer+l...@echobit.net] Sent: May-09-14 2:48 PM To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] Displaying custom error messages if deferred CA fails Hi all, I've Googled and searched the WiX mailing list, but I haven't been able to figure this one out yet. One of the biggest problems I've always had with MSIs is that they rarely return useful error messages. I'm using a custom bootstrapper and I'd like to display a custom error message if one of my deferred CA's fail. Since deferred CA's are pretty limited, I don't know how to pass an error value or message back to the installer from the CA that I can then use to display the proper error UI. What's the suggested approach? (I hope there's something better than setting a registry value.) Cheers, Soren ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users This message has been marked as Public by Steven Ogilvie on May-09-14 3:27:03 PM. The above classification labels were added to the message by TITUS Message Classification. For more information visit www.titus.com. ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users NOTICE: This electronic mail message and any files transmitted with it are intended exclusively for the individual or entity to which it is addressed. The message, together with any attachment, may contain confidential and/or privileged information. Any unauthorized review, use, printing, saving, copying, disclosure or distribution is strictly prohibited. If you have received this message in error, please immediately advise the sender by reply email and delete all copies. ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users