質問

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!

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top