2
votes

I have an install project that runs a custom action. The custom action itself uses some temporary files that are copied by the installer before the custom action is called. The files are deleted after the custom action completes.

Everything works fine during the install phase.

My issue is during the uninstall phase. Another custom action is called and it also needs to access these temporary files. My question is how to copy files (temporarily) on the machine during the uninstall phase?

Thanks in advance.

2

2 Answers

3
votes

While must of what Cosmin has answered is true, he doesn't seem to be aware that InstallShield has a feature called Support Files that already does everything he describes. Drag some files into Installation Designer | Behavior and Logic | Support Files | Language Independent and InstallShield will automatically stream them into the ISSetupFile table and sequence custom actions that extract the files to a temp directory during the install and clean up the files at the end.

The location of these files can be found using the [SUPPORTDIR] property. If you are using a deferred custom action then you'll have serialize this via the CustomActionData property.

Also if you are using DTF custom actions, you should be aware that if you add content to your CA CSPROJ with an action of Content and Copy Always that it'll be packaged up and extracted to the current directory to be accessed while your code is executing.

1
votes

Windows Installer doesn't support temporary files. So I assume you are simply installing some files and deleting them when install ends. This is not a good approach because for Windows Installer they are basically missing resources.

The correct approach for temporary files is to store them in Binary table and use custom actions which extract them when installation starts and delete them when it ends. This is supported directly by multiple setup authoring tools.

In your case you can try this approach:

  • don't delete the files during install (leave them on disk)
  • schedule your uninstall custom action before RemoveFiles action in InstallExecuteSequence

This way the uninstall custom action will have access to your files.