2
votes

I've got a custom action that runs a UI after the .msi deploys files. This UI sets the configuration and also deploys various things to various places (SQL servers, etc..). The UI itself is running in C# (.NET 2.0). How could I possibly get the state of the installer (that is, upgrade/install/repair and silent/minimalUI/fullUI, etc..)?

Basically, how can I access what mode the installer is in from custom UI based in C#/.NET 2 so that I can handle those states in my code?

(This is similar to Stack Overflow question How to add a WiX custom action that happens only on uninstall (via MSI)?, but not quite.)

1

1 Answers

1
votes

You can try to pass the values of the properties as parameters to your custom action that give you this information. The "Installed" property is set only if the package is running in maintenance (modify or remove). To differentiate between modify and remove these you can have check "REMOVE" property. Here is a list with the conditions you need to build inside your custom action.

  1. Condition for install: NOT Installed
  2. Condition for uninstall: REMOVE="ALL"
  3. Condition for maintenance: Installed AND REMOVE<>"ALL"

For upgrading, you need to use the property that you defined to be set if an older version is defined. Assuming you have used this method from Stack Oveflow question How to implement WiX installer upgrade?.

For the UI level of the package you can check the property UILevel.