Wixsharp: MigrateFeatures not behaving as expected

Created on 23 Oct 2019  路  2Comments  路  Source: oleg-shilo/wixsharp

I'm configuring upgrades like this:

c# project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default; project.MajorUpgradeStrategy.UpgradeVersions.MigrateFeatures = true;

When an upgrade is done, Windows Installer appears to behave as expected, as far as I can tell from the logs.

However, in custom actions I'm unable to determine which features are selected - session["ADDLOCAL"] is always empty, and as a result of course Session.IsFeatureEnabled(FEATURE_ID) is always false.

Is there any way to determine what features are installed in a custom action during an upgrade?

Done / Released question

Most helpful comment

Hah, totally forgot that I'd previous opened the related #737!

You are correct, e.Session.Features does have feature states, and with managed UI they are available in the BeforeInstall action.

All 2 comments

It is an interesting problem. Remember, we have found that ADDLOCAL is used to pass the user input (ticks in checkboxes) to control which features are installed. But in case of no user input the property is empty.

I am not sure where and how WiX/MSI keeps the installed features information but something tells me it does.

If you are not in deferred (elevated) CA you can always try and see if e.Session.Features has it.

And if it does then I will speedup delivery of #737 which then can be used in a new extension method session.IsFeatureInstalled(id).

Finding right semantics of the method names can be a challenge:

  • session.IsFeatureInstalled(id) - product is installed (or being upgraded) and the feature is too
  • session.IsFeatureEnabled(id) - product is being installed and the feature is selected by the user for the installation. Based on ADDLOCAL but falls back to WixSharp ADDFEATURES in deferred actions.

But let's see if my guess about session.Features during upgrade is right.

Hah, totally forgot that I'd previous opened the related #737!

You are correct, e.Session.Features does have feature states, and with managed UI they are available in the BeforeInstall action.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ayman-eltemsahi picture ayman-eltemsahi  路  4Comments

CADbloke picture CADbloke  路  4Comments

JamesWHurst picture JamesWHurst  路  5Comments

mgkeeley picture mgkeeley  路  5Comments

JasShao picture JasShao  路  4Comments