ClickOnce deletes my local database when it updates.. how not to?

十年热恋 提交于 2019-12-01 10:08:17

问题


I'm using ClickOnce to deploy my application. When the app runs the first time, if a db doesn't exist, it creates one.

Problem is, when I update, it removes the local database. Is there a way to tell it to ignore it?


回答1:


I imagine you're putting it in the applications directory... don't!

Put it in Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData or Environment.SpecialFolder.LocalApplicationData).




回答2:


Don't include the database in the deployment. Implement your own db creation (using script) when the database isn't present.




回答3:


In the project's Publish options, under Application Files, is the database file's Publish status set to Data File?



来源:https://stackoverflow.com/questions/1690444/clickonce-deletes-my-local-database-when-it-updates-how-not-to

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