2

We have a wix setup (based on wix version 3.9) with a standard wix package together with a so called bundle that shows a wpf gui (with Bootstrapper etc), where we can install, update and uninstall the shabang. Everything should be "by the book" as far as I can see...

Now to the problem: We are able to upgrade by change the version numbers, but we can't seems to be able to disable the uninstallation GUI to popup during the process.

I'm running out of ideas and this is something others must have been solved but I don't find any real solution out there.

As it's managed in C# against the so called engine it's some kind of code there we need.

Currently the code is like this. In the Run method in my BA class:

    protected override void Run()
    {
        Dispatcher = Dispatcher.CurrentDispatcher;
        var model = new BootstrapperApplicationModel(this);
        Logging logging = new Logging(model);
        var view = new MainView(model, logging, this.RunMode);
        model.SetWindowHandle(view);
        this.Engine.Detect();
        view.Show();
        Dispatcher.Run();
        this.Engine.Quit(model.FinalResult);
    }

Then in the MainView class (or actually the viewmodel behind) acts on this:

    public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging, LaunchAction runMode)
    {
        this.launchAction = runMode;
        this.model = appModel;
        this.logging = modelLogging;
        this.WireUpEventHandlers();
        this.OpenStartPageView();
    }

    private void WireUpEventHandlers()
    {
        this.model.BootstrapperApplication.PlanComplete += this.PlanComplete;
        this.model.BootstrapperApplication.ApplyComplete += this.ApplyComplete;
        this.model.BootstrapperApplication.ApplyBegin += this.ApplyBegin;
        this.model.BootstrapperApplication.ExecutePackageBegin += this.ExecutePackageBegin;
        this.model.BootstrapperApplication.ExecutePackageComplete += this.ExecutePackageComplete;
        this.model.BootstrapperApplication.PlanMsiFeature += this.SetPlannedFeature;
        this.model.BootstrapperApplication.DetectMsiFeature += SetFeatureDetectedState;
        this.model.BootstrapperApplication.DetectRelatedBundle += this.DetectRelatedBundle;
        this.model.BootstrapperApplication.DetectPackageComplete += this.DetectPackageComplete;
        this.model.BootstrapperApplication.Engine.Detect();
    }

Hopes that might gives some ideas how we have setup the gui.

It's feels that I need something like the below additional if case in the Activate function:

    public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging, LaunchAction runMode)
    {
        this.launchAction = runMode;
        this.model = appModel;
        this.logging = modelLogging;
        if (this.launchAction == LaunchAction.Uninstall && /* something */)
        {
            this.model.PlanAction(this.launchAction); // Uninstall
            return;
        }

        this.WireUpEventHandlers();
        this.OpenStartPageView();
    }

But I have no idea how to pass information from the different versions...

Thanks in advance!

J. Abrahamsson
  • 431
  • 4
  • 21
  • You mean that the MSI's own GUI is shown during the uninstall? Or does your WPF Gui show that it is uninstalling? – Patrick Allwood Feb 01 '16 at 14:48
  • @Patrick, it's the WPF GUI (in uninstallation mode) that shows for the pervious version. – J. Abrahamsson Feb 01 '16 at 15:08
  • Might be worth you showing some code then. I'm guessing this is a WPF GUI you've built yourself? You should be able to identify when the uninstall action is being run on the old version of your installer and update (or not) your UI accordingly? Are you able to make a stripped-down example of this happening? – Patrick Allwood Feb 01 '16 at 15:31
  • Thanks for the advice! I have added two snippets from the wpf project which is the reason for the problem in my opinion, but perhaps not where the solution should be... If I only could share information between the different installations (The newer version passing information to the previous version in some way) – J. Abrahamsson Feb 01 '16 at 22:05

1 Answers1

2

When doing an upgrade the newer version of the installation will call the previous version of the installation with the /q argument, which will give the installer BA the Command.Display = Display.None or Display.Embedded

So in the above example with the if-case it will be like the following:

    public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging, 
                         LaunchAction runMode, Display display)
    {
        this.launchAction = runMode;
        this.model = appModel;
        this.logging = modelLogging;
        this.displayMode = display;
        if (this.launchAction == LaunchAction.Uninstall && 
            (this.displayMode == Display.None || this.displayMode == Display.Embedded))
        {
            this.model.PlanAction(this.launchAction); // Uninstall
            return;
        }

        this.WireUpEventHandlers();
        this.OpenStartPageView();
    }

Explaination what I did above:

  • Added the Display in-parementer in the function call
  • Extended the if to handle the Display.None and Display.Embedded
J. Abrahamsson
  • 431
  • 4
  • 21
  • Hey Abrahamsson! I have also built a similar app and while upgrading it doesn't uninstall the previous EXE though it updates the MSIs. Did you face any similar issues? Desperately need some help man! – AnOldSoul Apr 26 '16 at 11:17
  • Hi mayooran, yes something similar. The new binaries was not installed, even if the version number was correctly updated. Or you could say we was unabled to uninstall the older version. We have stranded this update feature for now and the customer is currently forced to manually uninstall the older version first. We will however try again. – J. Abrahamsson Apr 29 '16 at 11:01
  • Hey Abraham! thanks for the reply mate! I found the solution and I have put it as an answer here http://stackoverflow.com/questions/36707985/wix-doesnt-remove-previous-version-of-burn-exe-during-major-upgrade/36797672#36797672 Should be working for you as well!!! – AnOldSoul Apr 29 '16 at 11:30
  • Oh! I must have missed your reply there. Good to know, thanks for the link! – J. Abrahamsson May 10 '16 at 21:22