Windows Installer does not install feature and doe

2019-08-18 17:17发布

A simple msi created using WiX. Trying to install a product. On some computers it will fail, without an error, and the installer log will contain these rows:

PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{7C9...0A0}'
PROPERTY CHANGE: Adding MIGRATE property. Its value is '{7C9...0A0}'
Product Code from property table after transforms:  '{68F...FAE}'
Product not registered: beginning first-time install
Doing action: INSTALL 
Doing action: InstallValidate 
Feature: ProductFeature; Installed: Absent;   Request: Null;   Action: Null 
MIGRATE = {7C9...0A0};{A9B...BCE}
Installation completed successfully.

Somehow, Windows Installer decides that there is nothing to do (Request: Null), even though it acknowledges that this is the first time install. That computer had previous version of the product installed. How do I force the installer to install?

Here is the relevant WiX code:

<Product Id="*"
           Name="..."
           Language="1033"
           Version="..."
           Manufacturer="..."
           UpgradeCode="8D8...196"> 

<Package Id="*"
             InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine"
             InstallPrivileges="elevated"
             Platform="$(var.Platform)" />

<Property Id="REINSTALLMODE" Value="amus" />

<MajorUpgrade AllowDowngrades="yes" IgnoreRemoveFailure="yes" AllowSameVersionUpgrades="no"/>

<Feature Id="ProductFeature" Title="..." Level="1" Absent="disallow" AllowAdvertise="no" InstallDefault="local" TypicalDefault="install">
      <Condition Level="1">True</Condition>

Full installer log: https://www.dropbox.com/s/abnryavh203a82w/acme_installer_log.txt?dl=0

2条回答
叛逆
2楼-- · 2019-08-18 17:53

You did not set MigrateFeatures in your MajorUpgrade element. The documentation says the default value is Yes.

http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html

The log shows you are doing an upgrade, therefore the only features that are going to be installed is the same set that are already installed.

It's not clear how many features there are in your product, but if you always want all features to be installed during an upgrade set MigrateFeatures to No.

Either way, it would be better to supply the entire log to see what's going on and if there is another explanation.

查看更多
Summer. ? 凉城
3楼-- · 2019-08-18 18:19

This got too long for a comment, adding as an answer. Just a couple of things:

  1. You definitely should not set REINSTALLMODE="amus" for any MSI package.

    • If you include merge modules in this setup you could downgrade shared files - even if you otherwise don't write to shared locations yourself.
    • The best would be the default "omus", but I guess "emus" is also ok (Reinstall if the file is missing, or is an equal or older version).
  2. It certainly looks like the MigrateFeatureStates action is at least related to the problem seen:

    • MigrateFeatureStates: based on existing product, setting feature 'ProductFeature' to 'Absent' state.

    • Your INSTALLLEVEL property looks fine.

    • You might want to open the compiled MSI and verify that there are no entries in the Condition table (which can change feature selection states). There should be nothing there, but perhaps just verify.

    • I suppose you could try to set the Absent attribute for the WiX Feature element to "disallow", recompile and see if this changes things. If this is your only feature I would make this change in addition to using Phils suggestion to set MigrateFeatureStates to "No". Why allow your only feature to be removed?

  3. It is a little odd how this problem has occurred. Perhaps you ran modify on your MSI and simply selected the feature to be uninstalled in the old installation on the machine? Sounds unlikely - especially if it is your only feature.

    • Did you install several earlier versions of your product on the machine in question, or was there only one prior version?

    • Again, are there entries in the "Condition table" in the compiled MSI? (Check using Orca).

    • Did you change the feature name in your newest package?

In any event you should be able to "fix" the broken install by 1) simply running your existing setup and adding ADDLOCAL=ALL to your msiexec.exe install command - I think that will override the MigrateFeatureStates action (not a real fix, just a workaround). Or 2) you can disable MigrateFeatureStates and recompile the setup - that should fix things permanently, and 3) if I were you I would set the Absent attribute for the WiX Feature element to "disallow" so that your (only?) feature can't be removed.

Phil, if you see this, do you know what the MIGRATE property seen in the log is about? It looks like some WiX specific stuff - unless it is something from this MSI's upgrade table:

MSI (c) (04:24) [13:01:38:751]: Doing action: FindRelatedProducts
MSI (c) (04:24) [13:01:38:751]: Note: 1: 2205 2:  3: ActionText 
Action 13:01:38: FindRelatedProducts. Searching for related applications Found application: [1]
Action start 13:01:38: FindRelatedProducts.
FindRelatedProducts: 
MSI (c) (04:24) [13:01:38:751]: PROPERTY CHANGE: Adding WIX_UPGRADE_DETECTED property. Its value is '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0}'.
MSI (c) (04:24) [13:01:38:751]: PROPERTY CHANGE: Adding MIGRATE property. Its value is '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0}'.
FindRelatedProducts: 
MSI (c) (04:24) [13:01:38:752]: PROPERTY CHANGE: Modifying WIX_UPGRADE_DETECTED property. Its current value is '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0}'. Its new value: '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0};{A9B1787A-32E4-4D51-819D-B3F879574BCE}'.
MSI (c) (04:24) [13:01:38:752]: PROPERTY CHANGE: Modifying MIGRATE property. Its current value is '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0}'. Its new value: '{7C945F97-A2CC-4EEB-87AC-3D23D6C490A0};{A9B1787A-32E4-4D51-819D-B3F879574BCE}'.
Action ended 13:01:38: FindRelatedProducts. Return value 1.

tandrasz: as far as I can see the two GUIDs that are found by FindRelatedProducts ({7C945F97-A2CC-4EEB-87AC-3D23D6C490A0};{A9B1787A-32E4-4D51-819D-B3F879574BCE}), are different from your new setup's product code ({68F5E655-2E2D-492E-B445-BE1650AF5FAE}). This makes it look like there are two "related products" found by FindRelatedProducts on the machine in question. Are two older versions of the same MSI installed, or do you have a "suite" of MSI files that all share the same upgrade code?. If you have two "unrelated" packages installed, perhaps MigrateFeatureStates finds no way to migrate the feature states between those two and the new package you are installing?

查看更多
登录 后发表回答