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

前端 未结 3 1554
生来不讨喜
生来不讨喜 2021-01-15 19:49

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 lo

相关标签:
3条回答
  • 2021-01-15 20:23

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

    0 讨论(0)
  • 2021-01-15 20:25

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

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

    0 讨论(0)
  • 2021-01-15 20:42

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

    0 讨论(0)
提交回复
热议问题