I have a Wix installer which installs and removes fine if I don't execute my custom actions. But if I do execute them then my custom action does its job, and the uninstall does succeed, but all of the files installed remain in the program files application directory.
On install, my custom action (After="InstallFiles") extracts a number of files from a Zip into directories under the main install directory. I also capture a list of all files extracted (added). This works perfectly.
On uninstall, my custom action (After="MsiUnpublishAssemblies") runs through the list and removes the added files, added sub-directories and the file list itself. This works fine - my added files are removed. But the primary files originally installed by the installer are left behind even though the installer goes through all the steps (as far as I can tell by the log file) and ends successfully.
Any ideas would be a great help here.
Thanks!
Update: I have tentatively solved this the brute-force way, but I would still like a real answer. Here's my brute-force code. I call it with a DirectoryInfo of my InstallDir.
private static void CleanupTheRest(DirectoryInfo dirInfo)
{
// until I figure out why the unistall won't remove these after executing my CA
foreach (var subDirInfo in dirInfo.GetDirectories())
{
CleanupTheRest(subDirInfo);
}
foreach (var file in dirInfo.GetFiles())
{
file.Delete();
}
dirInfo.Delete();
}