Having an issue with WIX upgrade

后端 未结 4 1147
暗喜
暗喜 2021-01-27 01:53

Having an issue with WIX installer upgrade. Previously we had 2 version of installers 1 for per-machine and another for per-user.

Currently we have developed a dual mode

相关标签:
4条回答
  • 2021-01-27 02:39

    If you had two setups before, it might be that you have two upgrade code and need to deal with both for the upgrade to work in all cases?

    It has been a long time since I dealt with per-user stuff, but in general you must author your Upgrade table to include both upgrade codes for your setups to detect all flavours of your previous install. The upgrade table allows you to detect any number of prior installs that should be scheduled for uninstall before your new product gets installed.

    The FindRelatedProducts MSI action will search all packages on the target machine in order to find any where the Upgrade Code property matches the value specified in the upgrade table.

    Make a verbose log file as has been suggested:

    msiexec.exe /I "File.msi" /QN /L*V "C:\Temp\msilog.log"
    
    /I = run installation sequence
    /L*V "C:\Temp\msilog.log"= verbose logging
    /QN = run completely silently
    
    0 讨论(0)
  • 2021-01-27 02:44

    Per-user installs allow the installation of the same product multiple times for different users - and in different versions too. This makes upgrades and patches rather difficult to deal with, and I dislike this per-user concept altogether. I prefer to set the installer per-machine as standard. I don't feel that much is lost in functionality, but a lot is gained in managability. Though this is not an answer to your question, it is worth pointing out that per-user installs is a flawed concept - at best.

    I don't know if it is an option to set your installer per-machine, but I found a way to migrate installs from per-user to per-machine automagically by using Installshield and its custom ISSetAllUsers custom action. The procedure is described here: windows Installer - uninstalling previous version when the versions differ in installation policy (per-user, per-machine)

    Wix does not feature such a custom action as far as I know, but you could write your own custom action using the Win32 API call ::MsiEnumRelatedProducts() as described by Rob Mensching here: how to change from per user to all user installation?

    Here is a similar post for reference: How can a perUser installation program deal with a perMachine older version of the program?

    Here is a blog describing (further) issues with per-user installs: Understanding “Per-User” or “Per-Machine” context for application Setup packages.

    Let me add a couple of further comments:

    • You can have per-user settings without a per-user install. This is no problem, just have the application set up the userprofile on launch. I prefer to install all resource files and settings per-machine and have the application copy them to each user for first launch initialization. This ensures that user settings are not entangled with your MSI at all.
    • It is rare to maintain two separate versions of the same product at the same time - hence users are all likely to use the same version of the product. Per-user is just more headache in this perspective.
    • The upgrade and patching logic involved in per-user installer scenarios beats me - it just doesn't make any sense to me. If there is a per-machine install already, does a per-user install make sense to you? Does this install the application one more time?
    • If per-user installs are still important, perhaps you can try ClickOnce (if it still works). Quote from Wikipedia: "...ClickOnce-deployed applications are considered 'low impact', in that they are installed per-user, not per-machine. No administrator privileges are required to install one of these applications. Each ClickOnce application is isolated from the others. This means one ClickOnce application is not able to 'break' another.". Per-user installs make more sense if they are hooked up to auto-updating and web-deployment.
    0 讨论(0)
  • 2021-01-27 02:46

    Windows Installer does not upgrade between per user and per machine, or vice versa. If you want this to happen you need to get in front of the install somehow and find out what type is already installed. Trying to do that when the product has been installed for another user (i.e. not the current installing user) is tricky. MsiEnumRelatedProuctsEx can be called a couple of times looking for per machine and per user installs to see what's going on. However there may be issues with you, User A, trying to uninstall a product that was installed per user by User B. If you are the same user it's easier. MsiEnumRelatedProductsEx can be called a couple of times to see if the product is per user or machine (in a launcher maybe) and you can uninstall the product before installing the new upgrade, or at least tell the user to do the uninstall. Anyway, it can be a mess, and the advice to stick with per machine installs is worth taking.

    I should also point out that allowing per user AND per machine installs on the same machine is a feature, not a bug.

    0 讨论(0)
  • 2021-01-27 02:52

    I believe this is occurring because in your installer the default mode is Per-User hence it is not detecting per-machine. You could use MSIGetProductInfo to find the installed products if the assignmenttype is “1” then you could set the below properties to Product Code of Per-Machine product WIX_UPGRADE_DETECTED OLDERVERSIONBEINGUPGRADED

    Use a custom action on button click or schedule it after FindRelatedProducts. This tells the installer of an existing version and installation is handle like an upgrade.

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