WP7 - Isolated Storage settings wiped on “Rebuild”

孤街醉人 提交于 2019-12-10 10:47:21

问题


I just discovered (the hard way) that if you deploy your application to a device after doing a "Rebuild" or a "Clean -> Build" from Visual Studio your app is first uninstalled and then reinstalled resulting in the isolated storage files being wiped.

The Application Deployment Tool always seems to do uninstall - reinstall irrespective of whether it was an incremental build or not.

Has anybody found a workaround to this? Of course, the most obvious one is never to rebuild your application, but what if you accidentally do? Currently, I don't have all the generated files under source control, so if I were to try to build the app on another computer it would be a rebuild (maybe I will add all the generated junk into source control if no one has a workaround)


回答1:


If I can suggest an alternative appraoch.. I think you will find it beneficial in other situations as well if you can introduce a little process to the generation of your test data so that it is easier to either a) restore or b) generate.

You could for example have a debug build only feature to upload/download the files on the device to a wcf service running locally on your PC (a simplified version of what Rongchaua did here).

Or, more work, if you are willing, but offering even more additional benefits would be to develop some automated testing capability into your app.. starting with generation of initial test data. Here's something you could look at to get started on that path.

Claus Konrad Blog: WP7: How to unit test a MVVM Light WP7-application

Granted these would take a bit of effort, but it's an approach that gives you some independence from manually generated test data, which in my experience invariably turns out to be a hassle at various times. And once solved, you find all sorts of reasons to thank yourself for doing it later.. whether it be saved time, or more robust testing because you can afford to be more aggresive with your test data/test execution and manage multiple test data configurations.




回答2:


There is a a workaround:

  • open the solution configuration manager
  • next to build is a deploy column, uncheck your project
  • press F5

This will launch the app that is already on the device without overwriting it (and deleting its storage).



来源:https://stackoverflow.com/questions/4697678/wp7-isolated-storage-settings-wiped-on-rebuild

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