简体   繁体   English

WiX更新奇怪的行为

[英]WiX Update strange behavior

So I use WiX 3.8 with a custom BootstrapperUI. 因此,我将WiX 3.8与自定义的BootstrapperUI一起使用。 For the custom UI i use WiX WPF. 对于自定义UI,我使用WiX WPF。

For the moment i use a full setup even for updating the program. 目前,我甚至使用完整的安装程序来更新程序。

When you start the bootstrapper you can choose between uninstall and update (if the program is already installed). 启动引导程序时,可以在卸载和更新之间进行选择(如果已安装该程序)。

When you choose update a componentdialog is shown where you can see the optional and vital components depending on the previous installation. 当您选择更新时,将显示组件对话框,您可以在其中看到可选组件和重要组件,具体取决于先前的安装。

Next, two configuration pages are displayed. 接下来,显示两个配置页面。

Until this point everything works very reliable, but when i start the installation(Update) it drives me crazy: 到现在为止,一切工作都非常可靠,但是当我开始安装(更新)时,我会发疯:

I most cases it works fine and everything is going how it should. 在大多数情况下,它都可以正常工作,并且一切都会按预期进行。 But sometimes it just did nothing. 但是有时它什么也没做。

For the update i use 我使用的更新

<RemoveExistingProducts After="InstallInitialize" />

so that normally everything will be uninstalled before the new version is installed. 因此通常在安装新版本之前,所有内容都将被卸载。 But when it fails to update, the packages seem to be just skipped. 但是,当更新失败时,似乎只是跳过了软件包。 A big problem for me to resolve the problem is, i was not able to reproduce that error. 我要解决的一个大问题是,我无法重现该错误。

My first attempt to search for a reason was to check the prerequisites, but they were fine. 我第一次寻找原因的尝试是检查先决条件,但是很好。 Next i checked the bootstrapperlog, but it says the the components just were not chosen for installing. 接下来,我检查了bootstrapperlog,但是它说这些组件只是未选择安装。

Here is the C# code i use for determining what the user had chosen: 这是我用来确定用户选择的C#代码:

public override void OnPlanPackageBegin(WPFBootstrapperEventArgs<Wix.PlanPackageBeginEventArgs> args)
    {
        base.OnPlanPackageBegin(args);
        string msg = "";
        if (Inst && !forceabsent) {
            if (update) {
                bool displayed = false;
                foreach (WixPackage item in config.pkgInfo.Packages) {
                    if (item.Package == args.Arguments.PackageId) {
                        displayed = true;

                        if (item.isChecked) {
                            break;
                        }
                        else {
                            args.Arguments.State = Wix.RequestState.None;
                        }
                    }
                }

                if (!displayed) {
                    args.Arguments.State = Wix.RequestState.None;
                }
            }
            else {
                foreach (WixPackage item in config.pkgInfo.Packages) {
                    if (item.Package == args.Arguments.PackageId) {
                        if (item.isChecked) {

                        }
                        else {
                            args.Arguments.State = Wix.RequestState.None;
                        }
                    }
                    msg += item.DisplayName + " " + item.isChecked + "\n";
                }
            }
        }
        if (forceabsent) {
            foreach (WixPackage item in config.pkgInfo.Packages) {
                if (item.Package == args.Arguments.PackageId) {
                    args.Arguments.State = Wix.RequestState.ForceAbsent;
                }
            }
        }
    }

Do you have any suggestions what else i can check to determine why the update is not working? 您有什么建议可以检查以确定我的更新为什么不起作用吗?

Sooo i found the answer myself, just because i stumbled randomly about a table which explained, that the condition Remove="ALL" also applies for modify and upgrade. 所以我自己找到了答案,只是因为我偶然发现一张解释表,条件Remove="ALL"也适用于修改和升级。

But that does not explains the randomness. 但这不能解释随机性。

the product i installed in this package is also available as standalone and i forgot to check that. 我在此软件包中安装的产品也可以独立使用,我忘了检查一下。 So it only occured when someone tried to upgrade his version and he installed all components with the same bundle. 因此,仅当有人尝试升级其版本并且他使用同一捆绑软件安装了所有组件时,才发生这种情况。

Thanks to all who have thought about a solution to my problem ;) 感谢所有想解决我的问题的人;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM