Wix:Disallowing installation of component: since the same component with higher versioned keyfile exists
Asked Answered
E

2

5

I am doing a compatibility check of MSI in the OPS environment before deploying to Production environment.

A part of this i am deploying first the latest MSI say "MSIv2 to OPS environment on top of MSIv1 and the MSIv2 automatically uninstall the MSIv1 and install MSIv2 without any issues.

Now when i am installing MSIv1 on top of MSIv2. MSIv1 is installed and it is showing in control pannel as installed.But when i see the directory path no .dll files are there in the bin folder.

i am logging the action of MSI in log file which tell ... Log: Disallowing installation of component: {AC7BC9EB-4F1D-4FEE-B0C2-478966229D8E} since the same component with higher versioned keyfile exists

Elfreda answered 18/2, 2016 at 7:37 Comment(1)
I posted a solution that worked for us in Install a file regardless of version number with WiXCara
E
1

The product code is "*" in wix. MSI get the version from one of the exe, which is deployed as part of msi. The exe is install the service when MSI is installed.exe is versionsed so MSI will have the same version. So when the lower version of MSI is installed the exe will also have the same version, hence exe compares with exe which is already there in the server and it decides not to install as the higher version already there.

So what I did is "RemoveExistingproduct" before="costing "

Which resolved the issue removing the product before the higher version.

Let me know if any other alternative is there and is it a right practice and what are the consequences.

Elfreda answered 20/2, 2016 at 14:12 Comment(3)
As mentioned above in my answer, did you set the "AllowDowngrades" property and test it?Striate
If this answered your question/helped you, please mark it as the answer.Striate
Can you Please let me know where to add "AllowDowngrades" in wix.Elfreda
S
15

Forgive me for the long answer, but I think its important that you understand the basics:

Did you change the product code between the 2 MSI versions? My guess is that you haven't changed the product code between the 2 versions and windows installer is considering this as a minor upgrade. First understand the difference between Major vs Minor upgrade.

Minor Upgrade

A minor upgrade is an update that makes changes to many resources. None of the changes can require changing the ProductCode. An update requires a major upgrade to change the ProductCode. A minor upgrade can be used to add new features and components but cannot reorganize the feature-component tree. Minor upgrades provide product differentiation without actually defining a different product. A typical minor upgrade includes all fixes in previous small updates combined into a patch. A minor upgrade is also commonly referred to as a service pack (SP) update.

Major Upgrade

A major upgrade is a comprehensive update of a product that needs a change of the ProductCode Property. A typical major upgrade removes a previous version of an application and installs a new version. A major upgrade can reorganize the feature component tree. During a major upgrade using Windows Installer, the installer searches the user's computer for applications that are related to the pending upgrade, and when it detects one, it retrieves the version of the installed application from the system registry. The installer then uses information in the upgrade database to determine whether to upgrade the installed application.

Now during Minor upgrade windows installer uses the following rules to replace existing files - Because unnecessary file copying slows an installation, the Windows Installer determines whether the component's key file is already installed before attempting to install the files of any component. If the installer finds a file with the same name as the component's key file installed in the target location, it compares the version, date, and language of the two key files and uses file versioning rules to determine whether to install the component provided by the package. If the installer determines it needs to replace the component base upon the key file, then it uses the file versioning rules on each installed file to determine whether to replace the file.

At the core of any installer is the actual installation of files. Determining whether to install a file is a complex process. At the highest level, this determination depends on whether the component to which a file belongs is marked for installation. Once determined that a file should be copied, the process is complicated if another file with the same name exists in the target folder. In such situations, making the determination requires a set of rules involving the following properties:

  1. Version
  2. Date
  3. Language

The installer only uses these rules when trying to install a file to a location that already contains a file with the same name. In this case, the Windows Installer uses the following rules, all other things being equal, to determine whether to install.

Highest Version Wins—All other things being equal, the file with the highest version wins, even if the file on the computer has the highest version.

Versioned Files Win—A versioned file gets installed over a nonversioned file.

Favor Product Language—If the file being installed has a different language than the file on the computer, favor the file with the language that matches the product being installed. Language-neutral files are treated as just another language so the product being installed is favored again.

Mismatched Multiple Languages—After factoring out any common languages between the file being installed and the file on the computer, any remaining languages are favored according to what is needed by the product being installed.

Preserve Superset Languages—Preserve the file that supports multiple languages regardless of whether it is already on the computer or is being installed.

Nonversioned Files are User Data—If the Modified date is later than the Create date for the file on the computer, do not install the file because user customizations would be deleted. If the Modified and Create dates are the same, install the file. If the Create date is later than the Modified date, the file is considered unmodified, install the file.

During a Minor Upgrade, the default file versioning rules can be overridden or modified by using the REINSTALLMODE property. The installer uses the file versioning rules specified by the REINSTALLMODE property when installing, reinstalling, or repairing a file. The default value of the REINSTALLMODE property is "omus".

Now you have to decide whether you are going to do a MinorUpgrade or a Major Upgrade for your MSI. If it is a Major Upgrade, then by default the old version of the product is uninstalled before installing the new version. Use the link "WIX MAJOR UPGRADE" below for more details on how to implement this. You can also set the below property within the MajorUpgrade Element - to make sure that you can install an old version on top of the new version.

 AllowDowngrades    YesNoType   When set to no (the default), products with lower version numbers are blocked from installing when a product with a higher version is installed; 
 the DowngradeErrorMessage attribute must also be specified. When set to yes, any version can be installed over any other version.

If you are sticking to a minor upgrade then, you will need to override the default file versioning rules using the REINSTALLMODE property as mentioned above and use the code "d"

d   Reinstall if the file is missing or a different version is present.

Then use the following msiexec command:

 msiexec.exe /i installer.msi REINSTALL=ALL REINSTALLMODE=vdmus
  1. MINOR UPGRADE
  2. MAJOR UPGRADE
  3. MINOR UPGRADE - Replace Existing Rules
  4. MINOR UPGRADE - File Versioning Rules
  5. REINSTALLMODE
  6. WIX MAJOR UPGRADE

Hope that helps!

Striate answered 18/2, 2016 at 19:8 Comment(4)
Check the links that I have mentioned in the answer above. It will be within the MajorUpgrade element.Striate
This is my original answer, I have deleted the other answers. I put in effort to create this answer and wanted to make sure that people understand the basics, thats why I copied it to related questions. Will make sure not to do that anymore.Striate
If it is a Major Upgrade, then by default the old version of the product is uninstalled before installing the new version. It's not quite true in case if a new version of MSI package has files with older version (and we want to install them over new ones, like in OP's question). Decision about which files will be updated is made before the uninstallation (in case of a recommended position of RemoveExistingproduct action). therefore the newer files will not be overwritten or in some cases files from the older package will removed and newer ones will not be installed at all.Britten
if you run into montonero suggested situation see this #32603833Mandy
E
1

The product code is "*" in wix. MSI get the version from one of the exe, which is deployed as part of msi. The exe is install the service when MSI is installed.exe is versionsed so MSI will have the same version. So when the lower version of MSI is installed the exe will also have the same version, hence exe compares with exe which is already there in the server and it decides not to install as the higher version already there.

So what I did is "RemoveExistingproduct" before="costing "

Which resolved the issue removing the product before the higher version.

Let me know if any other alternative is there and is it a right practice and what are the consequences.

Elfreda answered 20/2, 2016 at 14:12 Comment(3)
As mentioned above in my answer, did you set the "AllowDowngrades" property and test it?Striate
If this answered your question/helped you, please mark it as the answer.Striate
Can you Please let me know where to add "AllowDowngrades" in wix.Elfreda

© 2022 - 2024 — McMap. All rights reserved.