问题描述
我一直在vb.net中使用SQLite数据库(Patient_Database.db)的项目中工作。当我调试程序时,软件和数据库之间的连接有效,并且数据库存储在项目文件夹中,并自动传输到调试文件夹,如下所示:
I have been working on a project in vb.net which uses an SQLite database (Patient_Database.db). The connection between the software and the database works when I debug the program, and the database is stored in the project folder, and automatically transferred to the debug folder, as shown:
但是,当我发布项目以使其成为可执行文件时,数据库不包含在出版物中。我整天都在尝试各种在线演练,但是似乎无法使出版物在Debug文件夹的x64和x86文件夹中包含数据库或必要的SQLite.Interop.dll文件。
However, when I publish the project in order to make an executable, the database is not included in the publication. I have spent all day trying various walkthroughs online but I just don't seem to be able to get the publication to include the database or the necessary SQLite.Interop.dll file in the x64 and x86 folders in the Debug folder.
我发布的项目如下:
在Application Files文件夹中包含以下内容:
With the following inside the Application Files folder:
我意识到我可能正在做一些愚蠢的事情,或者我可能只是以完全不正确的方式来做这件事。如果有人可以纠正我有缺陷的方法,那将非常有帮助!
I realise that I might be doing something stupid, or that I might just be going about this in the entirely incorrect way. If anyone could correct my flawed methods that would be very helpful!
谢谢
推荐答案
关于评论,为您提供一些视觉帮助:
In regards to the comments some visual help for you:
- 打开主项目的项目属性
- 选择
发布
标签 - 选择
应用程序文件...
- Open project properties of your main project
- Select the
Publish
tab - Choose
Application files...
- 查找数据库文件
- 如果未列出,请首先选择
显示所有文件
- 将发布状态设置为
包括
- 下载组应为
必填项
。
- Find your db file
- If it is not listed, select
Show all files
first - Set the Publish Status to
Include
- The Download Group should be
Required
.
新发布后,数据库文件应包含在服务器上的 Application Files
中。
After a new publish the DB file should be contained in the Application Files
on your server.
编辑:
要使文件对于已发布的应用程序文件可见,您必须设置其生成操作:
To make the file visible for the published application files you have to set its 'Build Action':
这篇关于如何在已发布的vb.net项目中包含SQLite数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!