Search code examples
c#sqliteportabilityportable-applications

Open SQLite database in C# WITHOUT installing anything


I am writing a portable C# application designed to be run as a single executable file on a USB. It needs to be able to extract some data from a SQLite database. Because it is portable, installing something locally is not an option. I have seen questions like this and this but they require installing third party software.

How can I get this data without losing the portability?

Edit: I tried using the System.Data.SQLite NuGet package. It works, but then suddenly I have gone from a single executable file to an executable, a .dll and two additional folders. I can deal (albeit unhappily) with a single dll addition, but that is too much.


Solution

  • You have two options:

    1. Use IlMerge.
    2. Embed an assembly as a resource.