mstarnaud
Posts: 45
Joined: Mon Apr 15, 2013 9:44 pm

Temporary files not destroyed

Hi

It was my understanding that temporary files were destroyed during the InstallFinalize action. Knowing that, I added a folder called "Scripts" in Windows Volume/Temporary. In it, I added some files used by the installerclass, which runs between InstallExecute and InstallFinalize. And so I build and run the setup. If an error occurs in the installerclass, the Scripts folder gets removed. If the setup is a success, the folder stays there with all the files. Well that's odd. It's located in C:\Users\myusername\AppData\Local\Temp, along with some other files created by the setup such as the AI Resource Cleaner text file :
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | OnAiRemoveFiles start.
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | CollectRemoveFileData start.
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | CollectRemoveFileData end.
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | Actually files removal begin.
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | Removing folder: C:\Users\myusername\AppData\Local\Temp\Scripts\
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | Actually files removal end.
# 2013-05-17 @12:22:34 [PID=80808|Thread=73240] | OnAiRemoveFiles end.
# 2013-05-17 @12:22:35 [PID=80808|Thread=73240] | Using save file name: C:\Users\myusername\AppData\Local\Temp\AIBB_80808.tmp
In the Files And Folders window, on the Scripts folder, I even tried check the box "Remove Folder" and set the Operation to Always. But the folder still remains there on success.

Long story short, behind-the-scene scripts would get exposed to the customer and if I run the setup a 2nd time then it will use the old files instead of the new ones (and yes, the "Overwrite only if the existing files are older" box is checked by default and I left it checked).

Any idea why this is happening and how to remove the folder? I'm expecting creating an inline VB Script custom action should do the trick, but I suppose there should be some temporary file removal action/option.

PS : I might not be able to respond quickly, so don't be surprised if that happens.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Temporary files not destroyed

Hi,
Knowing that, I added a folder called "Scripts" in Windows Volume/Temporary.
Please keep in mind that in order to add a temporary file, which will be deleted at the end of the installation, you can use the "Temporary Files" toolbar button from the Files and Folders page. The file will not be deleted if you simply add it in the "Windows Volume/Temporary" folder as a regular file.
If an error occurs in the installerclass, the Scripts folder gets removed.
The folder gets removed in this case because the installation is rollbacked, when the error is occurred by the InstallerClass custom action and all the files created by the installation are removed.
In the Files And Folders window, on the Scripts folder, I even tried check the box "Remove Folder" and set the Operation to Always. But the folder still remains there on success.
The "Remove Folder" action is executed during the "Remove Resources" standard action which is placed before the "Add Resources" standard action. So, the folder still remains there because when the "Remove Folder" action is executed the folder is not already created.
Any idea why this is happening and how to remove the folder?
The files in this folder will be deleted if you add them using the "Temporary Files" toolbar button, but unfortunately, the ".NET Installer Class" custom action cannot use temporary files.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mstarnaud
Posts: 45
Joined: Mon Apr 15, 2013 9:44 pm

Re: Temporary files not destroyed

Ah, I see, so not using the Temporary Files button made them behave as permanent files. Thanks for the answer. I guess it also explains why I was able to use them in my installerclass (which I was not able to to in my previous tests when I used the Temporary Files button). But then I have 2 new questions:

- Is there a way to add temporary files in a synchronized way (so they refresh automatically)?
- How would I achieve this : I want the installerclass to use some files, which should be in an auto-found temp folder (like in my example), but those files and nothing else should be deleted, like when it rollbacks. At least for now I'm just going to create a folder with a unique-ish name (product name property) and add VBscript actions to delete it before and after the installation.
EDIT : I set the folder to Remove Folder : Always Remove even if not empty. Then I add the installerclass between Add Resources and Finish Execution. Then I add the DeleteFolder VBscript between InstallExecute and InstallFinalize. This works, but will delete the folder even if files from other projects were present. It also leaves 2 extra temp files : AI_ResourceCleanerLog and AIBB_1234.tmp. I think I can live with that.
tslewis
Posts: 65
Joined: Wed Mar 13, 2013 7:06 am

Re: Temporary files not destroyed

I had a host of issues with creating custom actions using the installer class.

I highly recommend u switch to a wix custom action class.

Like yu i wanted to be able to delete the installer class after install but you cannot. With a wix custom action u do not have to install the dll custom action, the dll is attached tonyhe exe of the installer so is not exposed to the user.

There are also other suntax issues i had with the installer class, it was very painful.

My advice, using an installer class is a waste of time, dont do it
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Temporary files not destroyed

Hi,
- Is there a way to add temporary files in a synchronized way (so they refresh automatically)?
Please keep in mind that this is the default behavior, all the files are automatically refreshed at the build time.
- How would I achieve this : I want the installerclass to use some files, which should be in an auto-found temp folder (like in my example), but those files and nothing else should be deleted, like when it rollbacks
To achieve that, you can create a custom action that deletes your installer class files at the end of the installation.

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

Return to “Building Installers”