Gyum Fox
Gyum Fox

Reputation: 3647

Self-deleting installer in WiX

I would like my MSI to self-delete after the installation process is complete. How can I achieve this? Anyway to do it in WIX only? Do you have to create a custom action?

For those wondering, this installer is generated on the fly and bundled to a specific configuration. After the installation is complete, the MSI file has no use anymore (the user must download a new installer with a fresh configuration to reinstall).

Upvotes: 0

Views: 161

Answers (1)

PhilDW
PhilDW

Reputation: 20790

This isn't going to be useful, mainly because the MSI file is needed after the install is complete. Rule 31:

http://blogs.msdn.com/b/windows_installer_team/archive/2006/05/24/605835.aspx

Any kind of repair (automatic or user repair) will require the original MSI file. You're better off deleting it at uninstall time.

In general, the way I've done this type of thing is to get an executable into the user's temp location (don't install it there, copy it there with a custom action) and arrange for it to run and delete the MSI file. Just rely on eventual cleanup of the temp directory to delete the exe. However, it won't be transparent if it requires elevation to do the delete, and popups of unfamiliar programs asking for elevation may get denied.

Upvotes: 1

Related Questions