[wix-users] Validate a success full process code form the Bootstrapper

Farrukh Waheed farrukh1 at gmail.com
Wed Oct 26 23:36:09 PDT 2016


Hi,
I'm handling e.Status in ApplyComplete event.  and return error code to
engine:

switch (e.Status)
                        {
                            case 0:
                                StatusMessage =
AppResource.MsgInstallSuccessfullyFinished;
                                break;
                            case -2147023294:
                                StatusMessage =
AppResource.MsgCancelledByUser;
                                break;
                        }
BootstrapperApplicationModel.FinalResult = e.Status;

and then in main class

Engine.Quit(BootstrapperApplicationModel.FinalResult); //Return the error
code to engine.

I never tried experimenting with ExecutePackageComplete, if it invoked
Rollback immediately or after passing ApplyComplete. As far I remember, it
would always have to pass through ApplyComplete.






On 26 October 2016 at 21:40, Phill Hogland <phill.hogland at rimage.com> wrote:

> as I read IBootstrapperApplication.h (~line 680) you should return
> Result.Ignore AND set MsiPackage/@Vital='no', but I have not actually done
> this so maybe there is other advise.
>
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of
> Nicolas Clement <nicolas.clement at bbconsult.co.uk>
> Sent: Wednesday, October 26, 2016 11:17:48 AM
> To: WiX Toolset Users Mailing List
> Subject: Re: [wix-users] Validate a success full process code form the
> Bootstrapper
>
> Hi,
>
> What I'm looking isn't how to return the error code from my bundle to a
> batch launcher, but the opposite how to get the error code from the batch
> and return it to my bundle without having my bundle starting to rollback
> but still been able to know that my batch had an error.
>
> By the way I'm using Wix3.10, c# and Winform.
>
> For this I tried something like:
>
> private void OnExecutePackageComplete(object sender,
> ExecutePackageCompleteEventArgs e)
> {
>         If (e.Status == -2147024895)
>         {
>                 e.Result = Result.Continue; // also tried
> Ignore,Ok,None,Yes
>         }
> }
>
> But the bundle still rollback.
>
> Also I don't know If it's a bug but the Error EventHandler doesn't catch
> the error.
>
>
> Regards,
>
> Nicolas
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Phill Hogland
> Sent: 26 October 2016 16:45
> To: wix-users at lists.wixtoolset.org
> Subject: Re: [wix-users] Validate a success full process code form the
> Bootstrapper
>
> In general you might want to look at the InstallationViewModel.cs file in
> the WixTollset source of the WixBA project.  That is a WPF project, but
> your approach may need to be different if you are using a different display
> technology.
>
>
> In WPF your model would hold a 'result' property and a 'state' property in
> the VM.  In the handlers for PlanComplete and ApplyComplete save the
> 'result' code to your model.  Your View can present different information
> depending on your result property and if your 'state' property is
> InstallationState.Failed or InstallationState.Applied, etc.  You might also
> want to look at the Executeerror handler.   And when your bundle exits you
> can call this.Engine.Quit( your-result-code); to pass the result code back
> as the return code of your bundle.exe, for processing by a batch launcher.
>
>
> The wix4\src\Setup\WixBA is the approach which I use.  It is a little
> different from wix3, but the same basic concept.
>
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of
> Nicolas Clement <nicolas.clement at bbconsult.co.uk>
> Sent: Wednesday, October 26, 2016 9:11:14 AM
> To: wix-users at lists.wixtoolset.org
> Subject: [wix-users] Validate a success full process code form the
> Bootstrapper
>
> Hi,
>
> I would like to know how it's possible to have the same behaviour as
> "<ExitCode Value="" Behavior="success"/>" in my custom Bootstrapper so that
> I can show an finish message depending on the returned process code of my
> batch file.
>
> Regards,
>
> Nicolas
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>


More information about the wix-users mailing list