Possible Bug With Temp Files - Advanced Installer Community
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Possible Bug With Temp Files

Hello,

Scenario:
- Add a file (let's call it "MyHelperApp.exe") as a temp file (http://www.advancedinstaller.com/user-g ... files.html)
- Add a deferred custom action (let's call it "RunMyHelperApp") to your install that runs "MyHelperApp.exe". In my installer, I added this custom action after the "RegisterComPlus" action.
- Install 1.0.0 of your program.
- Install 1.1.0 of your program as a major upgrade.
- During the major upgrade, at some point, "MyHelperApp.exe" is removed before the "RunMyHelperApp" custom action executes in the 1.1.0 part of the install.

What I think is happening:
- During the beginning of the major upgrade to 1.1.0, "MyHelperApp.exe" is copied to the machine.
- During the execution phase of the major upgrade, the "RemoveExistingProducts" custom action removes version 1.0.0.
- When 1.0.0 is removed, "MyHelperApp.exe" is removed, since it was a temporary file in 1.0.0.
- "RunMyHelperApp" eventually runs as part of 1.1.0, but it fails, since "MyHelperApp.exe" was removed during the uninstall of 1.0.0 in "RemoveExistingProducts"


Not sure if this would be considered a bug or as-designed. To get around this issue, I'm setting the "Do not remove the file when setup ends" option for temp files. This means I need to clean up the temp files manually during a major upgrade.


Thanks.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Possible Bug With Temp Files

Hi,

Indeed, this happens exactly as you explained. The problem appears because the same extraction path is set for the temp files in both versions of the application (e.g. TempFolder).

The solution is to create a sub-folder with a unique name for each version (e.g. [|ProductVersion]) and place all the temp files in this folder. This will prevent the old version from accidentally removing the extracted files of the new version.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: Possible Bug With Temp Files

Ah, using the product version in the folder name is a good idea.


Thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Possible Bug With Temp Files

You're welcome. Glad to help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”