Search code examples
silverlightwindows-phone-8deploymentrebuildisolatedstoragefile

All files in IsolatedStorageFile store disappear after rebuilding WP8 Silverlight solution


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?


Solution

  • 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.