File of a new component isn't installed because there was an old component with the same file

后端 未结 1 1111
天涯浪人
天涯浪人 2020-12-12 01:52

We have a problem that a fie is not installed upon a major update

  • We have a major update with
相关标签:
1条回答
  • 2020-12-12 02:08

    Similar Answer: How to Explicitly Remove dll During Majorupgrade Using Wix Toolset


    Major Upgrade Downgrade: In order to overwrite binaries with higher version numbers on major upgrades there are a few options.

    • The preferred approach would be to use a companion file (third party files).
    • Or if you can: compile a new binary with a higher version number (for your own files).

    REINSTALLMODE: The MSI property REINSTALLMODE can be used - but it has a number of side-effects:

    Setup 1: Version 1.0.0 for a setup:

    msiexec.exe /i Setup1.msi /qn
    

    Setup 2: Version 2.0.0 for the major upgrade setup:

    msiexec.exe /i Setup2.msi REINSTALLMODE=amus /qn
    

    Several Problems: There are several issues with REINSTALLMODE that makes it an unsafe feature to use (try emus instead? See documentation - a little less brute force maybe). It is a shame that this setting applies to all features in the setup - that makes it very dangerous:

    • can downgrade shared files system-wide (if there are merge modules included - for example)
    • can cause inconsistent version estate since an old package can be installed after a newer one and downgrade only some of the shared files
    • can downgrade or wipe-out settings in non-versioned files (and registry settings)
    • can cause a significant increase in the number of requested reboots due to attempts to needlessly replace in-use files of the same version.
    • there are several further issues that are quite specific

    Companion Files: A snippet below on how to use companion files in WiX:

    <..>
    
    <Component Id="MyFile.exe" Feature="Main">
      <File Id="MyFile.exe" Source="MyFile.exe"></File>
    </Component>
    
    <Component Id="MyFile_2.exe" Guid="{0EBDFD64-017B-428F-BB67-3D82EA2A99AF}" Feature="Main">
      <File Source="MyFile_2.exe" CompanionFile="MyFile.exe"></File>
    </Component>
    
    <..>
    

    One-Line Summary: In the second component we point to the first component's file so that MyFile_2.exe will install whenever MyFile.exe is installed - regardless of versioning issues.


    Hack Binary Version: An ugly, but effective option is to change the version of the binary file using Visual Studio to set a higher version number. Side effects are several:

    • you break digital signatures
    • you can create "version confusion"
    • there are risks involved writing a new binary from Visual Studio
    • it is a "hack manual step" - you might need to keep doing this for new versions?
    • etc...

    Move, Rename: If you can de-couple the new file from the old by renaming it or moving it you can work around the problem. If you get a new version again for the future, you might have to do this again. Clunky.

    "Load From": Putting the file somewhere shared and load it from that specific location and removing the old copy from your installation folder. Could that work? This means the file could also be delivered by another setup at that location.


    Version Lying: In Installshield there is a concept of being able to set a specific version number to a file. I am not sure how to implement that in WiX. There is also an "always overwrite option" that apparently sets a maximum value for the version so the existing file is always overwritten.


    Some Links:

    • Why Windows Installer removes files during a major upgrade if they go backwards in version numbers
    • "Downgraded" MS dll disappears on upgrade - Windows Installer
    • Install a file regardless of version number with WiX
    • How to make better use of MSI files
    • The opposite side of it: file preservation and file overwrite rules.
    0 讨论(0)
提交回复
热议问题