问题
Our application saves user preferences in isolated storage.
However,it's proving tricky to remove these files from our uninstaller!
I can enumerate all of the files in IsolatedStorage (using the MSDN example code), locate the ones that are related to our strongname key, and attempt to remove/delete them. Unfortunately, that's where it all falls apart:
MaxSize is not defined for this store. An operation was performed that requires access to MaxSize. Stores obtained using enumeration APIs do not have a well-defined MaxSize, since partial evidence is used to open the store.
Can anyone help with this? I guess I could spend days trying to fake up some Evidence to allow the installer to act as an imposter, but there must be a better (quicker, cleaner) way?!
If not, I guess I'm heading back to the good old registry.
回答1:
In case anybody else ever wants to know the answer...
It appears the best solutions might be:
Move the Isolated Storage code into a separate Assembly which can be called from both the main application and the uninstaller, so that they can both access the data.
Add a means for executing the main application with a command line flag that instructs it to delete the Isolated Storage files and exit, then call it from the uninstaller.
or save all this messing about and ditch Isolated Storage altogether
来源:https://stackoverflow.com/questions/1159850/isolatedstorage-delete-preferences-in-uninstaller