IsolatedStorage: Delete preferences in uninstaller?

五迷三道 提交于 2019-12-20 05:13:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!