How does the saved state dictionary work in the installer?

I am trying to find documentation on how the stateSaver / savedState Dictionary file for a Windows installer works in overriding Install and UnInstall, can someone help.

In my CustomAction installers, which I wrote in the registry entry, every time I do this, I add some details from this state to stateSaver. I assumed that this was taken into account when deleting, but how?

I think that the StateSaver dictionary is written to the file during installation, and when deleting the contents of this file, .InstallState is read and used to install the found records.

My problem is that some registry entries remain after deletion, I don’t know why my understanding of how the dictionary works does not help either.

Here is an example of what the installation does

RegistryKey expressionEvaluatorVersionKey = expressionEvaluatorKey.CreateSubKey(packageVersion); 

This creates an additional key for the key added with the Windows installer. How to remove this extra key when deleting?

+6
installer installation windows-installer
source share
1 answer

I'm not sure installState is your problem. This is just a file containing various key-value pairs, I don’t think that something smart is going on there.

It sounds to me like the (built-in) Uninstaller process can say: "I need to delete this key, but it is not empty, so I will leave it."

Could you put all the registry keys / entries (and therefore all the delete keys / entries) into the user action DLL?

Another problem that I found with installState - and therefore I try to avoid it - is that people do not know how to come and remove the installState file. Depending on how you wrote your unique Uninstall action, this may mean that you will never get a clean uninstall of your program, because you will get exceptions when you try to read the things you expect in a missing dictionary.

Since you seem to be using a custom DLL to do the job, I hope my suggestion is not so burdensome?

+1
source share

All Articles