0

I am testing publishing a program with Visual studio 2012, but when I install said program I get errors because a database file I need is missing.

I have a small sqlite file I have included as content and I have set it to copy to output directory. and everything works if I am debugging it. but when i publish the file isn't there anymore.

I guess the problem has two answers I can see, I either need to figure out how to have the file be put there when it is installed or on startup of the program look for the file and if it doesn't exist, copy it to there from a resource?

any clues would be appreciated!

thanks!

Herrozerro
  • 1,601
  • 1
  • 22
  • 37
  • Is this an ASP.NET site? Generally you do not want to publish your dev database to production, because then your production data will be overwritten every time you publish your site. http://msdn.microsoft.com/en-us/library/dd465343%28v=vs.100%29.aspx – Jason Jun 25 '13 at 18:36
  • Its a C# wpf program. the database is just an empty shell for data to be entered into. – Herrozerro Jun 25 '13 at 19:04

1 Answers1

1

The following link should show how to include files for publishing: http://msdn.microsoft.com/en-us/library/kzy0fky2(v=vs.80).aspx

Specifically:

Files with the Build Action property set to Content are designated as application files and will be marked as included by default; they can be included, excluded, or marked as data files. The exceptions are:

•Data files such as SQL Database (.mdf and .mdb) files and XML files will be marked as data files by default.

If you change the handling from Data File (Auto) to Include, Visual Studio should output it correctly.

Community
  • 1
  • 1
Harrison Paine
  • 611
  • 5
  • 14
  • No problem! Also check out this link for more details as to why that worked: http://msdn.microsoft.com/en-us/library/d8saf4wy.aspx Using `Include` instead of `Data File` doesn't leverage some ClickOnce features that you may or may not want – Harrison Paine Jun 25 '13 at 20:20