问题
I have a UWP app deployed to the Microsoft Store, and in use. It's a hobby project, available for free, and although I will update it now and then such updates will probably be infrequent. I'm about to release a new version to the store - it will be the first time I have done this.
The app includes a SQLite database, which is created at runtime (so not part of the solution / source code).
Update: the folder this ends up in is:
C:\Users\...\AppData\Local\Packages\[Package ID]\LocalState
I'd like to release a new version without having the user lose their existing data in the database.
What's the best upgrade approach?
- Use existing Package/Identity/Name, but with an incremented version.
- Use a different Package/Identity/Name.
- Something else?
回答1:
Just chose option 1, the app gets updated, while the app data
- the files in LocalState/RoamingState/TempState
folders - is untouched during the upgrade.
Quoted from Windows Apps Team blog:
App data is preserved across app updates delivered by the Windows Store and the Windows Phone Store. So app updates must be prepared to load app data that was generated by any previous version of the app.
Option 2 creates a new app in the Store, which has nothing to do with your existing app.
来源:https://stackoverflow.com/questions/52304093/uwp-app-upgrade-approach-without-losing-user-data