问题
I'm developing a WP8 Silverlight app which uses the IsolatedStorageFile store for app's data. At some point I detected that if I issue the Rebuild Solution command in VS.NET, VS uses full deployment of my project to the emulator or an attached device instead of incremental deployment. The typical Build output in this case looks like this:
2> Connecting to Emulator 8.1 WXGA 4.5 inch...
2> The application is already installed on the device. Checking if an incremental deployment is possible...
2> Doing full deployment as project was cleaned and rebuilt...
2> Uninstalling the application...
2> Installing the application...
Sure, all app's settings and data stored in IsolatedStorageFile disappear at that.
As a developer, I may need to rebuild my solution from time to time, or unpack it from the archive backup I do. But this means that my end users will lose all their data too when I publish a new version of my app in the Marketplace after rebuilding the project!
My question is how to save all the data on the device after deploying a rebuilt WP8 Silverlight project to it? Is there a file, or a setting in one of the files produced while compilation responsible for that (maybe, a GUID, or time stamp)? Which can be saved and added to the new rebuilt stuff to prevent data loss with the next app deployment?
回答1:
IsolatedStorage data are deleted whenever the app is uninstalled, which is exactly what VS does when you rebuild the project. This will not be the case when end users will update your app. The app will be updated rather than uninstalled. So that will preserve your data from IsolatedStorage.
回答2:
An alternative solution to this problem is the IsoStorSpy utility suggested by the user lisp in this thread.
Using this utility, we can store all app files in the corresponding IsolatedStorage data area to the pc HDD, and then easily upload them back after deploying the rebuilt app.
来源:https://stackoverflow.com/questions/25362744/all-files-in-isolatedstoragefile-store-disappear-after-rebuilding-wp8-silverligh