0

I have a custom bootstrapper application installer which has been worked well with the normal features such as install, uninstall and so on. But now I need to add a upgrade feature for the installer exactly for the bundle, but it always shows the installation UI or uninstallation UI during the installation process of newer bundle installer. I know the old version should be removed during this process but I expect the previous version is removed before the newer version installed and the uninstallation process should be in silence mode.

I am new be with Wix, but I have read lots of articles in StackOverflow, and tried most of the related solutions. Such as the following links:

How do I detect the currently installed features during a MajorUpgrade using WiX Burn MBA Bundles?

How to perform Wix Upgrade with custom bootstrapper

Wix doesn't remove previous version of burn exe during major upgrade

WiX burn Upgrade shows uninstall UI at the end

Unfortunately None of them work for me. I don't know the call stacks of the burn engine well, so I post my code to here!

In my code, I have tried the following solutions:

private void DetectComplete(object sender, DetectCompleteEventArgs e)
{
    if (LaunchAction.Uninstall == WixBA.Model.Command.Action)
    {
    WixBA.Model.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall");
    WixBA.Plan(LaunchAction.Uninstall);
    }
}


private void BootstrapperApplication_ApplyComplete(object sender, ApplyCompleteEventArgs e)
{
    if (this.model.BootstrapperApplication.Command.Action == LaunchAction.Uninstall && isRelatedBundlePresent) // this will be called in case of Upgrade of the bundle
    {
            CustomBootstrapperApplication.Dispatcher.InvokeShutdown();
    }
}

If anyone could help me to review my code, that would be appreciate. When you have downloaded my code, please change the MsiVersion parameter with a version number and change the ProjectRootDir paramter to be your local path of solution file in the "ccnetcall-build-language-package.bat" file in "Build" folder, and then create the different versions of the installers by launching the bat file.

Thanks in advance!

Kevin Yang
  • 13
  • 5

1 Answers1

1

The BootstrapperApplication.Command struct contains the display field that your BA should respect when deciding to display UI (or not).

During the upgrade of the old version the value should be Display.Embedded or Display.None (I forget which off the top of my head).

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • Thank you very much for reply me so quick, Master. Actually I could get the "display" field in the log, I remember it is Display.Embedded when upgrading. But it is a read only field, I could not control it display the UI or not. On another word, I dont know how to control the UI, when it should display and when it should be hide. – Kevin Yang May 27 '19 at 08:29
  • `Display` is a read-only field. *Your* code should look at that field and choose not to display UI. – Rob Mensching May 27 '19 at 14:45
  • Sorry, I am a little puzzled. I know my code should choose not to display UI according to the Display field, but I dont know how to implement it. Is there any related tutorial or sample code for it? I am really a new be with wix, so please be my director. Thanks in advance! – Kevin Yang May 28 '19 at 05:23
  • I thought it should have taken some effect on not displaying UI after I use the following code: 1. WixBA.Plan(LaunchAction.Uninstall); 2. CustomBootstrapperApplication.Dispatcher.InvokeShutdown(); but it does not work for me. – Kevin Yang May 28 '19 at 05:24