Question

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.

Was it helpful?

Solution

You have two options:

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

OTHER TIPS

Well I think is about as good as it is going to get: I got it down to a single executable and a single dll file.

To do this I changed the architecture of the executable from Any CPU to x86 only, and then installed the "System.Data.SQLite.x86" NuGet package.

If anyone knows how to keep the capability but in a single executable file, I would be very grateful.

Try Costura.Fody (browse on Nuget Packages), i usually use this one and it packs everything in a single exe, i believe it should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top