简体   繁体   English

WiX 捆绑安装和用于升级的独立 MSI

[英]WiX bundle install and standalone MSI for upgrades

I have a WiX bundle that includes the .NET core runtime installer and my product MSI.我有一个 WiX 捆绑包,其中包括 .NET 核心运行时安装程序和我的产品 MSI。 If I don't tweak anything, I get two entries in the Add/Remove Programs list - one for the bundle and one for the product MSI.如果我不进行任何调整,我会在“添加/删除程序”列表中获得两个条目——一个用于捆绑包,一个用于产品 MSI。 I have tried two approaches of showing only one but I run into some issue either way.我尝试了两种只显示一种的方法,但无论哪种方式我都遇到了一些问题。

Approach #1 - Set MsiPackage attribute "Visible" to "no" in the bundle.方法 #1 - 在包中将 MsiPackage 属性“Visible”设置为“no”。 This leaves a single entry in Add/Remove Programs (for the bundle).这会在“添加/删除程序”中留下一个条目(用于捆绑包)。

The problem here is if they do an initial install with the bundle, but later only install the MSI to upgrade, they get 2 entries in the Add/Remove Programs list - the original bundle one and the new product one.这里的问题是,如果他们使用捆绑包进行初始安装,但后来只安装 MSI 进行升级,他们会在“添加/删除程序”列表中获得 2 个条目 - 原始捆绑包一个和新产品一个。

Approach #2 - Set Bundle attributes DisableRemove and DisableModify both to "yes" in the bundle.方法 #2 - 在包中将 Bundle 属性 DisableRemove 和 DisableModify 都设置为“yes”。 This gives a single Add/Remove Programs entry - this time for the product MSI, not the bundle.这提供了一个添加/删除程序条目 - 这次是针对产品 MSI,而不是捆绑包。

The problem here is the following sequence:这里的问题是以下顺序:

  1. Install bundle version 10安装捆绑包版本 10
  2. Uninstall ARP entry (product MSI)卸载 ARP 条目(产品 MSI)
  3. Install bundle version 9安装捆绑包版本 9

That third step fails because the system sees a version 10 bundle still installed.第三步失败,因为系统发现仍然安装了版本 10 捆绑包。

Our bundle is 30MB and our product is 3MB.我们的捆绑包是 30MB,我们的产品是 3MB。 I don't want to have to have every subsequent update download another bundle when I know .NET is already present and not necessary.当我知道 .NET 已经存在并且没有必要时,我不想让每个后续更新都下载另一个包。 So what approach can I use to install the bundle originally but later update with an MSI and not run into the issues above?那么我可以使用什么方法最初安装捆绑包,但后来使用 MSI 更新而不遇到上述问题?

EDIT: The only approach I can think of is to have a custom action on uninstall which detects whether or not the MSI was dispatched via the bundle (as opposed to standalone) and if it is not, it then uses something like MsiEnumRelatedProducts() to find the product guid for the bundle and inline uninstalls that.编辑:我能想到的唯一方法是在卸载时有一个自定义操作,它检测 MSI 是否通过捆绑包发送(而不是独立发送),如果不是,则使用 MsiEnumRelatedProducts() 之类的东西来找到捆绑包的产品指南并内联卸载它。 Seems super messy and I'm not sure if it would even work or if that invocation would hit some kind of "installer already running" error.看起来超级混乱,我不确定它是否会起作用,或者该调用是否会遇到某种“安装程序已在运行”错误。

Setting ARPSYSTEMCOMPONENT = 1 in Property Table of MSI installer(or from command line) will prevent it from displaying in Add or Remove programs.在 MSI 安装程序(或从命令行)的属性表中设置ARPSYSTEMCOMPONENT = 1将阻止它在添加或删除程序中显示。 So, Your first approach should work after this change.因此,您的第一种方法应该在此更改后起作用。

I think the simplest solution here is to never distribute MSIs and create two versions of the bundle - one that only contains our package, and the other which contains our package plus the .NET runtime.我认为这里最简单的解决方案是永远不要分发 MSI 并创建两个版本的捆绑包 - 一个只包含我们的 package,另一个包含我们的 package 和 Z303CB0EF9EDB9082D61BBBE5825D97 运行时。 Always mark the embedded MSI as visible=no and have the bundle's entry show up in ARP.始终将嵌入式 MSI 标记为可见 = 否,并使捆绑包的条目显示在 ARP 中。 This ensures bundles always update bundles, ARP shows the correct version, and that nothing ever gets left behind on an uninstall.这可确保捆绑包始终更新捆绑包,ARP 显示正确的版本,并且在卸载时不会留下任何东西。

I tried to implement a custom action on MSI uninstall to query the bundle's Upgrade Code and manually remove it.我尝试在 MSI 卸载上实施自定义操作,以查询捆绑包的升级代码并手动删除它。 Unfortunately, WiX bundles do not show up to the system as normal products.不幸的是,WiX 捆绑包不会作为普通产品出现在系统中。 So while I could manually parse the registry, the more robust APIs like MsiEnumRelatedProducts() cannot be used.因此,虽然我可以手动解析注册表,但无法使用更强大的 API,例如 MsiEnumRelatedProducts()。 Therefore, I think the bundle-of-one is my best solution at this time.因此,我认为捆绑包是我目前最好的解决方案。

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

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