net项目中包含SQLite数据库

net项目中包含SQLite数据库

本文介绍了如何在已发布的vb.net项目中包含SQLite数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在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:


  1. 打开主项目的项目属性

  2. 选择发布标签

  3. 选择应用程序文件...

  1. Open project properties of your main project
  2. Select the Publish tab
  3. Choose Application files...

  1. 查找数据库文件

  2. 如果未列出,请首先选择显示所有文件

  3. 将发布状态设置为包括

  4. 下载组​​应为必填项

  1. Find your db file
  2. If it is not listed, select Show all files first
  3. Set the Publish Status to Include
  4. 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数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 14:51