1

I ran installer which contains custom action:

 <Custom Action="renameIndex" Before="InstallFinalize"></Custom>

this just run one bat file which was previously installed on drive.

In never version of this installer both that custom action and bat file were removed from installer. In the installation logs i can see that bat file is removed:

MSI (s) (A8:5C) [13:08:27:790]: Component: indexSCO.bat; Installed: Local;   Request: Absent;   Action: Absent
MSI (s) (A8:5C) [13:08:28:062]: Executing op: FileRemove(,FileName=indexSCO.bat,,ComponentId={EC857BEC-50CA-4DE7-B80B-D1DF4AC37CF5})

but the Custom action is still being called even though it was removed from InstallExecuteSequence

Is there any link that causes that custom action to be called because if existed in previous version of installer or I should search for mistakes in installer file?

szpic
  • 4,346
  • 15
  • 54
  • 85
  • Did you change the package Idwhen you build the new msi? Otherwise most likely a cached version of your msi is used. Package Id=* is a good idea to prevent such issues. – scaler Oct 03 '22 at 13:12
  • @scaler Yes i have id=*. I dont think that this is version issue. As i wrote. bat file is removed from wix and it remove it. – szpic Oct 03 '22 at 13:42
  • Open the newest MSI in Orca and check the CustomAction table - is the custom action still there? How did you sequence the custom action in your first setup? Was it set to only run on install or did it run on uninstall as well? – Stein Åsmul Oct 03 '22 at 16:41
  • While installing newer version, are you upgrading from previous one? – Vivek Jaiswal Oct 04 '22 at 05:32
  • @VivekJaiswal yes. I am installing as update on the old one – szpic Oct 04 '22 at 05:36
  • @SteinÅsmul i checked it with Orca. There is no Customaction RenameIndex in CustomAction Table. – szpic Oct 04 '22 at 05:38
  • Did you remove custom action from both InstallExecuteSequence and InstallUISequence? What is custom action condition? It might be possible that uninstallation of previous version is executing that specific custom action as it would be running from install cache. – Vivek Jaiswal Oct 04 '22 at 05:42
  • @VivekJaiswal this custom action had no conditions. just to run before InstalFinalize. You can see it in question. I checked on code repository and name "renameIndex" does not exist anywhere in the code so i need to believe that developer removed everything. When it is being run as clean installation then there is no problem. – szpic Oct 04 '22 at 06:10
  • As the custom action has no condition, uninstallation of previous version executing it from installer cache(C;\windows\installer). To confirm it, if you just run the uninstallation of previous version from control panel, you will still face the problem. This problem is not in newer version. – Vivek Jaiswal Oct 04 '22 at 06:20
  • @VivekJaiswal ok thanks for explanation. So i will just go with clean instalation as previous version is incorrect. Tried to re add this CA with conditions but same effect. Please add your answer and i will accept it. Thanks! – szpic Oct 04 '22 at 07:18
  • 1
    You should never use batch files in MSI custom actions. Error handling is poor and recovery practically impossible. Please have a quick read on [why custom actions are not recommended](https://stackoverflow.com/q/46179778/129130) in general. [An answer on the problem of old custom actions running](https://stackoverflow.com/a/47944773/129130). And [an answer on properties involved in major upgrades](https://stackoverflow.com/a/51090120/129130) (please do skim this one). And [one more answer you should skim](https://stackoverflow.com/q/50912568/129130). – Stein Åsmul Oct 04 '22 at 14:07
  • 1
    [One more on custom action condition debugging](https://stackoverflow.com/a/53937078/129130) - how to check whether custom actions are running when they should - in different installation context (install, uninstall, major upgrade, patching, etc...). – Stein Åsmul Oct 04 '22 at 14:20

1 Answers1

2

While upgrading to newer version from previous one, by default uninstallation of previous version is invoked first. This will be launched from installer cache(C:\Windows\Installer). As the above custom action had no condition in previous version, it was triggered during uninstallation.

Once the uninstallation is completed by RemoveExistingProducts action, newer version msi InstallExecute sequence will be triggered and the new changes(removed custom action) will come into play.

Vivek Jaiswal
  • 861
  • 1
  • 7
  • 20