3

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.

4
  • You don't really need to install anything. Just download an additional dll and have it present with you program. Commented Sep 7, 2013 at 8:20
  • This looks like a little more than a single dll Commented Sep 7, 2013 at 8:32
  • Since the source code is available - you could integrate the managed dlls (System.Data.SQLite.dll and System.Data.SQLite.Linq.dll) into your own dll. You'll still be left with 1 or 2 native dlls files. Why do you care so much for the number files? Commented Sep 7, 2013 at 12:37
  • @Vadim The idea of this program is that it can easily be transferred, copied, moved around, etc. as simply as possible. Having multiple files complicates things Commented Sep 7, 2013 at 14:28

3 Answers 3

2

You have two options:

  1. Use IlMerge.
  2. Embed an assembly as a resource.
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.