MsiProcessMessage (and I assume also the managed WiX equivalent
session.message) is more versatile than just error messages. It will
show information messages, let you manage the progress bar from a CA,
write your own logging into the MSI log etc. You will never see any
strange messageboxes popping up from the MSI if the install is silent
and you use MsiProcessMessage in your CAs. You maybe assuming it's
just a dumb messagebox function, but it's not.

I don't know what your custom bootstrapper does exactly, but if it's
based on the standard Windows Installer callback for providing your
own UI in response to installer activity based on this:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb309215(v=vs.85).aspx

then you are providing UI for all installer activity and can show
whatever you want, but you are still responding to MsiProcessMessage
calls from the MSI CA. Your external UI handler code will see the
results of MsiProcessMessage calls as installer records that will be
the equivalent of INSTALLMESSAGE_FATALEXIT or INSTALLMESSAGE_WARNING,
just to pick two examples. Then you display them using your own UI.
The same is true for FilesInUse records - you'll see one and you'll
provide the UI messagebox and return one of the legal responses to the
install engine.

So in summary, MsiProcessMessage is always the way to send messages
out from a CA to whatever UI is handling them, whether it's the MSI
file's UI or your own UI set up by using MsiSetExternalUIRecord.  I'm
not familiar enough with the WIX bootstrapper UI to know for a fact
that it does the MsiSetExternalRecordUI thing.
---------------
Phil Wilson


On Wed, May 14, 2014 at 11:09 AM, Soren Dreijer
<dreijer+l...@echobit.net> wrote:
> Hi Phil,
>
> Correct me if I'm wrong, but as far as I've been able to tell with
> MsiProcessMessage() it doesn't just send a message to the installer; it
> actually causes an error dialog to be shown (if you set the error
> property). What I would *really* want to achieve here is to catch that
> message in my bootstrapper and handle the error myself. After all, I've
> built a custom installer UI and I don't want weird message boxes popping
> up. :)
>
> Cheers,
> Soren
>
>
> On Mon, May 12, 2014 at 10:42 AM, Phil Wilson <phildgwil...@gmail.com>wrote:
>
>> I think the difficulty here is that you have a design pattern that
>> requires a property to be set by a deferred custom action so you can
>> show a custom dialog. However perhaps the more usual approach is to
>> simply use Session.message in your CA (or call the underlying
>> MsiProcessMessage) to display an error message, and this automatically
>> won't show during a silent install, and there are variations that will
>> show a canned message from the Error table. Custom dialogs aren't
>> usually shown because there's some integration between
>> MsiProcessMessage and the rest of the install that doesn't really work
>> if you substitute a custom dialog. For better or worse it's what
>> people use to report errors from deferred CAs, add them into the MSI
>> log etc.
>> ---------------
>> Phil Wilson
>>
>>
>> On Mon, May 12, 2014 at 8:57 AM, Soren Dreijer <dreijer+l...@echobit.net>
>> wrote:
>> > Hey guys,
>> >
>> > So, I don't think I understand how this helps me. Like John pointed out,
>> I
>> > cannot set properties in deferred custom actions, so I'm still at a loss
>> as
>> > to how I can communicate error values/messages back to the installer UI
>> so
>> > I can show a sensible error message.
>> >
>> >
>> > On Fri, May 9, 2014 at 1:00 PM, Steven Ogilvie <steven.ogil...@titus.com
>> >wrote:
>> >
>> >> Classification: Public
>> >> I would love to see your code for that :) " 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."
>> >>
>> >> -----Original Message-----
>> >> From: John Cooper [mailto:jocoo...@jackhenry.com]
>> >> Sent: May-09-14 3:51 PM
>> >> To: General discussion about the WiX toolset.
>> >> Subject: Re: [WiX-users] Displaying custom error messages if deferred CA
>> >> fails [P]
>> >>
>> >> 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:
>> >> &#149; 3 signs your SCM is hindering your productivity &#149;
>> Requirements
>> >> for releasing software faster &#149; 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:
>> >> &#149; 3 signs your SCM is hindering your productivity &#149;
>> Requirements
>> >> for releasing software faster &#149; 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:
>> >> &#149; 3 signs your SCM is hindering your productivity &#149;
>> Requirements
>> >> for releasing software faster &#149; 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
>> >> 4:00:16 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:
>> >> &#149; 3 signs your SCM is hindering your productivity
>> >> &#149; Requirements for releasing software faster
>> >> &#149; 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
>> >>
>> >
>> ------------------------------------------------------------------------------
>> > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> > Instantly run your Selenium tests across 300+ browser/OS combos.
>> > Get unparalleled scalability from the best Selenium testing platform
>> available
>> > Simple to use. Nothing to install. Get started now for free."
>> > http://p.sf.net/sfu/SauceLabs
>> > _______________________________________________
>> > WiX-users mailing list
>> > WiX-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>
>> ------------------------------------------------------------------------------
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos.
>> Get unparalleled scalability from the best Selenium testing platform
>> available
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to