Wix Installer app won't install when run twice and uninstalls the app

梦想的初衷 提交于 2020-01-05 04:33:27

问题


I wrote a simple wix installer with gui, which installs well. But when I run the same .msi file a second time, it takes me through the normal installation process in the gui, but uninstalls my app at the end. Then if I run this same .msi file a third time, the installer still does through the installation gui normally, but ends up doing "uninstallation".

I don't understand why it doesn't behave like every other installer and handle installation and uninstallation gracefully.

here is part of my product xml

 <Product Id="*" Language="1033" Codepage="1252" Name="..." 
       Version="$(var.ProductVersion)" Manufacturer="..." UpgradeCode="BDF9E310-5897-48D4-AB08-889D405F9X56">

<Package InstallerVersion="300" Platform="x64" Compressed="yes" InstallScope="perMachine" Manufacturer="..." 
         Comments="..." Description="..." Keywords="..."/>

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

回答1:


<Product Id="*" Name="..."  Version="" Manufacturer="..." UpgradeCode="...">

Auto-GUID: The Id="*" section means "auto generate product code" (the use of the * means auto-generate). When you do that every build or rebuild of your setup gets a new product code. This amounts to a major upgrade in MSI-terms if you also change the ProductVersion (in one of the first 3 digits) AND you have a MajorUpgrade element such as the one you are using in the source (which is standard by the way).

Solution: You can hard code a product code if you like to be able to control when it changes.


Note: You might be in a dirty state on the system with many "overlapping" installations. Look for duplicate installations of your product by opening the Add / Remove Programs applet: WinKey + Tap R => appwiz.cpl => Enter. I would uninstall all instances, and maybe prefer to test setups on virtuals henceforth? (this also helps to discover hidden runtime depenencies - provided the virtual is saved without most runtimes).


Links: Some links with some background information on major upgrades.

MSI SDK:

  • https://docs.microsoft.com/en-us/windows/win32/msi/major-upgrades

Flexera / Installshield:

  • Major Upgrade vs. Minor Upgrade vs. Small Update
  • About component, package, product and upgrade codes in Windows Installer
  • Creating MSI Update Packages
  • Designing an Update-Friendly MSI Installation
  • https://www.flexerasoftware.com/install/products/installshield/installshield-tips-tricks.html


来源:https://stackoverflow.com/questions/58819830/wix-installer-app-wont-install-when-run-twice-and-uninstalls-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!