您可以在您的exe文件中捆绑SQLite吗? [英] Can you bundle SQLite in your exe file?

查看:40
本文介绍了您可以在您的exe文件中捆绑SQLite吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对编程还比较陌生,并且正在开发一个很小的应用程序,该应用程序基本上是用于特定游戏的计算器.因此,我希望用户能够更改一些与游戏相关的值,并且这些更改可以在应用程序执行之间保持不变,即保存,但我不想使用多个文件(EXE).

I am relatively new to programming and am making a tiny application that is basically a calculator for a particular game. As such I would like the user to be able to change some of the values related to the game and the changes to persist between application executions, i.e. to be saved but I don't want to use more than 1 file (the EXE).

我了解SQLite和ILMerge,但是不确定是否可以创建它,以便EXE文件本身包括一个小型数据库,以便用户可以更改和保存该exe中的值.我尝试搜索该词,但不知道使用什么确切的术语,所以我没有运气.

I know about SQLite and ILMerge but am not sure if it is possible to make it so that the EXE file includes in itself a tiny database so that the user can alter and save values in that exe. I tried searching for that but don't know what exact terminology to use so I had no luck.

推荐答案

它没有您想象的那么复杂

It is not as complex as you think

您可以使用NuGet或自己下载.

You can either use NuGet or download it yourself.

使用NuGet然后搜索"System.Data.SQLite",然后安装它.这会将您需要的引用添加到您的项目中.

Using NuGet then search for "System.Data.SQLite", and install it. This will add the references you need to your project.

基本上就是这样!当您构建/编译时,您的应用程序将包含您需要的所有内容,并将其包含在输出目录中(其中将包含DLL).无需在您的应用程序中嵌入任何其他.exe或其他任何内容(当然,除了数据库!)

And that is basically it! When you build/compile then you will have everything you need included with your app in your output directory (which will include DLLs). No need to embed any other .exe or anything else with your app (except your database of course!)

本文显示了SQLite入门: https://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application

This article shows getting started with SQLite: https://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application

在您的情况下,我认为您的应用程序是如此简单,以至于您可能不需要数据库,并且对数据文件的简单持久性(可能是JSON格式)就足够了.但是您仍然可以将其作为学习练习.

In your case, I think your app is so simple that maybe you don't need a database and simple persistence to a data file (maybe in JSON format) is enough. But you can still do this as a learning exercise.

这篇关于您可以在您的exe文件中捆绑SQLite吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆