Search code examples
wixwindows-installerconditional-statementsreinstall

CA conditions during REINSTALL


I have a custom action which must be executed if the spesial feature's action state is "install". Now I am using next condition:

(&ca_feature=3 AND NOT &ca_feature=2) OR (!ca_feature=3 AND PATCH) .

I want to execute it also in Modify Mode. When the feature is already installed and user do not want to delete it. I thaught to append OR (REINSTALL><ca_feature OR REINSTALL=ALL) to my condition string. but it seems not working.. I can't get how the MSI is working in some situations, that is my problem. but i also can't find the answer in the internet. Please,tell me what i'am doing/understanding wrong?thanx in advance


Solution

  • The condition looks correctly. The last part with REINSTALL would be true if your feature is to be reinstalled.

    Although you can try to use !ca_feature=3 instead of REINSTALL><ca_feature: that would run the CA when the feature is installed.


    I think your condition could look this way:

    (&ca_feature=3) OR (!ca_feature=3 AND NOT (REMOVE><ca_feature OR REMOVE=ALL))
    

    It would run the CA when this feature is scheduled for install, or if it's installed and is not scheduled for remove.

    This part AND NOT &ca_feature=2 in the first parenthesis is redundant because &ca_feature cannot be equal to 2 if it's already equals 3.


    Use MSI verbose logging to better understand what's going on. Run your installation this way:

    msiexec /i package.msi /l*vx log.txt
    

    When a feature state changes or a property is modified, you'll see a message in the log. Then you'll be able to compare the actual values with your expectations. Use other operation switches instead of /i to run it in modify or remove mode.