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

后端 未结 2 1052
南方客
南方客 2021-01-24 22:16

I have created a wix exe using burn bootstrapper. When I try to do a major upgrade on it, the new version gets installed. The features missing in the new upgrade are also remove

相关标签:
2条回答
  • 2021-01-24 22:34

    I found the solution atlast. I had to hook onto the DetectComplete method and call the plan method on the Engine. Below is how I did it.

    void DetectComplete(object sender, DetectCompleteEventArgs e)
        {
            Bootstrapper.Engine.Log(LogLevel.Verbose,"fired! but does that give you any clue?! idiot!");
            if (LaunchAction.Uninstall == Bootstrapper.Command.Action)
            {
                Bootstrapper.Engine.Log(LogLevel.Verbose, "Invoking automatic plan for uninstall");
                Bootstrapper.Engine.Plan(LaunchAction.Uninstall);
            } 
        }
    
    0 讨论(0)
  • 2021-01-24 22:39

    From the logs I'm seeing a few things.

    In regards to the Upgrade, it looks like it's properly detecting all the packages and planning them correctly.

    The two installer packages are being installed as a major upgrade and the related bundle (the one that is being upgrade) is being detected and run to uninstall it as well.

    The issues all seem to be coming from your uninstall of the previous bundle.

    The log you labeled as "Log File 1" is actually the log from when your upgrade re-ran the currently installed bootstrapper to remove it. The problem as I see it is right here:

    [0980:3888][2016-04-22T16:49:19]i100: Detect begin, 2 packages
    [0980:3888][2016-04-22T16:49:19]i102: Detected related bundle: {f57e276b-2b99-4f55-9566-88f47c0a065c}, type: Upgrade, scope: PerMachine, version: 1.0.1.0, operation: None
    [0980:3888][2016-04-22T16:49:19]i103: Detected related package: {8C442A83-F559-488C-8CC4-21B1626F4B8E}, scope: PerMachine, version: 1.0.1.0, language: 0 operation: Downgrade
    [0980:3888][2016-04-22T16:49:19]i103: Detected related package: {8201DD23-40A5-418B-B016-4D29BE6F010B}, scope: PerMachine, version: 1.0.1.0, language: 0 operation: Downgrade
    [0980:3888][2016-04-22T16:49:19]i101: Detected package: KubeUpdaterServiceInstallerId, state: Obsolete, cached: Complete
    [0980:3888][2016-04-22T16:49:19]i101: Detected package: MosquittoInstallerId, state: Obsolete, cached: Complete
    [0980:3888][2016-04-22T16:49:19]i199: Detect complete, result: 0x0
    [0980:3888][2016-04-22T16:51:43]i500: Shutting down, exit code: 0x0
    

    The desired process for all burn bootstrappers is to do Detect phase, Plan phase, Apply phase.

    For some reason your uninstall when being run by a related bundle is just stopping after the detect phase.

    I also suspect your machine may be in a weird state right now. I think you have several installed, but hidden in the add remove programs list, installs for KubeUpdaterServiceInstaller and MosquittoInstaller.

    The first thing I would do is stop installing anything on your build/development machine. When authoring installers you will make mistakes and cause machines to get in weird states with regards to knowing what it has installed and doesn't have installed on it. I would suggest using a virtual environment for all your installer testing. When you mess something up you can easily revert to a clean state and start testing again. If you are using a virtual environment then just ignore this paragraph you're doing it right but make sure you clean everything before testing changes and testing the upgrade.

    In your MSI wix I would suggest you use a "*" as the Product Id so you don't have to change it every build.

    <Product Id="*" Name="Installer" Language="1033" Version="1.0.0.0" Manufacturer="Zone24x7" UpgradeCode="E90569B5-372E-45BB-B101-58E0B75AB5C7">
    

    and in your major upgrade element add AllowSameVersionUpgrades="yes"

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" />
    

    So you don't have to update the version every time you want to test an upgrade just rebuild the msi installer.

    For reference, here are my Bootstrapper upgrade logs for the bootstrapper application and the logs for when it removes the old install. Notice some differences

    The Upgrade Install

    When it re-runs the old installation to remove it

    The upgrade log looks basically the same as yours which is good but the re-run to uninstall log has some differences. I'm not totally sure without basically seeing your whole codebase (and I don't have the time or will to do that) how to fix these issues but hopefully something in this answer will help you out.

    0 讨论(0)
提交回复
热议问题