如何防止安装两次具有相同升级代码/版本的 WiX 包 [英] How to prevent WiX bundle with same UpgradeCode/Version to be installed twice

查看:26
本文介绍了如何防止安装两次具有相同升级代码/版本的 WiX 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 MSI 打包的应用程序,该应用程序与各种必需的第三方工具一起制作成 WiX 包.由于应用程序的工作方式,我已禁用 MSI 中的修改和修复操作,以便在再次安装相同版本之前需要完全卸载.

I have an application packaged with MSI that is made into a WiX bundle together with various required third-party tools. I have disabled modify and repair actions in the MSI du to how the application works, to require full uninstall before installing the same version again.

当我单独运行 MSI 时,它按预期工作:安装程序不能运行两次.再次运行完全相同的 Bundle 时同样适用.但只需重新构建包(使用相同的 UpgradeCodeVersion),安装就会继续进行(这次要快得多),我最终会在已安装的程序中出现重复条目.我真的很想阻止这种情况并使捆绑包作为 MSI 工作.

When I run the MSI separately, it works as expected: the installer cannot be run twice. The same applies when running the exact same Bundle again. But simply by rebuilding the bundle (using same UpgradeCodeand Version), the installation instead proceeds (much faster this time), and I end up with a duplicate entry among installed programs. I really would like to prevent that and make the bundle work as the MSI.

我已尝试在捆绑包上设置各种条件;NOT WixBundleInstalledWixBundleInstalled != 1 等.但这些似乎都不起作用.

I have tried with various conditions set on the bundle; NOT WixBundleInstalled, WixBundleInstalled != 1, etc. But none of that seems to work.

作为参考,这里是 bundle 声明:

For reference, here's the bundle statement:

<Bundle UpgradeCode="{FAF9CBDD-BE89-4B18-9921-FD5B426B5B0C}" IconSourceFile="$(var.SolutionDir)Resources\product.ico" 
          Name="Product 4.4" Version="4.4.0.0" Manufacturer="My Company" DisableModify="yes" Condition="NOT (WixBundleInstalled = 1)">

推荐答案

如果您添加 OptionalUpdateRegistration 标记,您将在注册表中获得一个条目,您可以将其用作 InstallCondition为您的 MSI 包

If you add the OptionalUpdateRegistration tag, you will gain an entry in the registry you can use as an InstallCondition for your MSI package

<OptionalUpdateRegistration ProductFamily="MyProductFamily" Name="MyAppBundle"/>

<小时>

<util:RegistrySearch Id="SearchForMyProduct" 
                     Root="HKLM" 
                     Key="SOFTWARE\WOW6432NODE\MyCompany\Updates\MyProductFamily\MyAppBundle" 
                     Value="PackageVersion" 
                     Result="exists" />

<小时>

<MsiPackage Id="MyMsi"
            InstallCondition=SearchForMyProduct
            DisplayName="My Wonderful Product"
            SourceFile="MyProduct.msi"
            ForcePerMachine="yes"/>

这将阻止新版本的捆绑包再次安装MyProduct".这不会阻止在您已经从 MSI 安装包之后安装它.为此,您还可以为 MSI 创建的密钥添加 RegistrySearch 标记.

This will prevent a new version of the bundle from installing "MyProduct" again. This will not prevent the bundle from installing it after you've already installed it from the MSI. To accomplish that, you can also have a RegistrySearch tag for a key created by your MSI.

这篇关于如何防止安装两次具有相同升级代码/版本的 WiX 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆