Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the savedState Dictionary work in the Installer?

I'm struggling to find documentation on how the stateSaver/savedState Dictionary works for the Windows Installer, in the Install and UnInstall overrides, can someone help.

In my installers CustomAction I've been writing to registry entries, each time I do I add some of it's detail to the stateSaver. I had presumed this was taken into account when uninstalling but how?

I think the stateSaver Dictionary is written to file when you install, and on uninstall the content of that file, .InstallState is read and used to install the entries it finds.

My issue is some registry entries remain after uninstall, I don't know why and my lack of understanding of how the Dictionary works is not helping.

Here's an example of what the Install is doing

RegistryKey expressionEvaluatorVersionKey = expressionEvaluatorKey.CreateSubKey(packageVersion);

This is creating a Sub Key for a key added with the Windows Installer. How should I delete this Sub Key in the uninstall?

like image 927
learnerplates Avatar asked Aug 25 '09 11:08

learnerplates


1 Answers

I'm not sure installState is your issue. This is just a file containing various key-value pairs, I don't think there's anything intelligent going on in there.

This sounds to me like the (built-in) Uninstaller process could be saying "I need to delete this key but it isn't empty, therefore I'm going to leave it".

Could you possibly put all registry key/entry creation (and by implication all key/entry removal) into the Custom Action dll?

Another problem I have found with installState - and this is why I try to avoid it - is that it is not unknown for people to come along and delete the installState file. Depending on how you've written your Uninstall custom action, this might mean you never get a clean uninstall of your program because you'll get exceptions when you try to read stuff that you expect to be in the dictionary which is missing.

Since you appear to be using a custom action dll already to do this work hopefully my suggestion is not so onerous?

like image 174
PeteH Avatar answered Nov 26 '22 03:11

PeteH