views:

41

answers:

1

I've got an uninstaller that performs some actions and then prompts the user to reboot. I'd like a directory to be deleted after the reboot takes place. I know there's a way to do this, I'm just not sure how.

I'm using a WiX installer, and I'd imagine I could use that to do so, somehow, but I'm open to alternatives (whatever's simplest is just fine with me). My target platform is Windows 7, though it would be nice if this worked with older versions of Windows as well.

What's the simplest way to mark this directory for deletion after a reboot?

+1  A: 

If you have a locked file condition Windows Installer can handle the deletion after the reboot but there is no built-in way of instructing it to only delete it after a reboot. I think the only way you could do it would be to use a custom action to record a RunOnce registry entry that instructs it to do the delete. You can't use the Registry table for this as Windows Installer has no way of recording to the registry as part of an uninstall.

Still, you are coloring outside the lines on this one so I'd want to understand the why of this requirement in determining if it's valid.

Christopher Painter
Well, the installer won't be aware of the file. It's something that the application downloads. In fact, it's a windows service, and after it gets uninstalled, there's still a handle to it somewhere. The easiest solution seemed to be to just delete it after the user reboots after the uninstall.
Mike Pateras
The installer can be made aware of files and folders it didn't install. It can be told to remove them on install, uninstall or both. It just can't be explcitly told to wait until after a reboot to do it although if there is a locked file that's what will implictly happen.
Christopher Painter
That sounds perfect. Do you know how I might do such a thing?
Mike Pateras
Take a look at the RemoveFile element. http://wix.sourceforge.net/manual-wix2/wix_xsd_removefile.htm
Christopher Painter