WIX: using a temporary file during installation

I am writing a WIX installer and I have the following requirement:
During installation, I need to transfer the absolute path to the file (allow call A) included in my installer to a COM component that already exists on the hard drive and is part of another program. I already wrote the corresponding user action, which expects the path to file A. I do not want to include A as a file installed in the Program Files folder and deleted during the uninstall process. Instead, I would like to put A only temporarily on the hard drive, invoke my custom action, which forces the COM component to use the contents of A, and then remove A from the disk. Is there an easy way to achieve this?

I tried to use a binary table and store A there, however I don't know how to reference A using the absolute path. I know I can put A outside the MSI file, but I would like each file installer to need one MSI.

Any help would be appreciated.

+7
binary wix custom-action temporary-files
source share
2 answers

I would take this approach.

Install file "A" in any directory. Run the user actions required to update the COM component. Then run another custom action or modify the one currently written to delete the file after it is no longer in use. This leaves no traces of the β€œA” file, and if you plan to have user actions performed only during installation, you don’t have to worry about this when uninstalling.

+7
source share

Removing the file that MSI installed means that MSI will consider it β€œbroken” and try to automatically repair it if it is called. This happens automatically in several cases (e.g. declared shortcuts and COM registration), so I would recommend against it. Leave the file there instead - it has done its work, and there is no harm leaving it there.

+8
source share

All Articles