0

After screwing my head several times over with SQLite causing havok on some machines, I stumbled across a 'Managed Only' version of the library. http://sourceforge.net/projects/sqlite-dotnet2/files/SQLite%20for%20ADO.NET%202.0/1.0.66.0/

I got excited and put this into my project folder, so now my project works on everyone's computer, regardless of architecture!

I got so excited in fact, that I decided to try using ILMerge again (since all my dependencies are now managed) instead of having to copy the DLL files as resources and write them to the output folder if it detects their absence.

I compiled the EXE with the following command:

ilmerge.exe /target:winexe /zeroPeKind /out:"Core View.exe" CoreView.exe System.Data.SQLite.dll OpenHardwareMonitorLib.dll

(The zeroPeKind flag is needed because although SQLite is managed, it isn't flagged as such and causes errors on compilation if zeroPeKind isn't present)

Problem now is that, although it starts up fine, I get the following error when trying to do any database operations when the DLL file is not present:

System.DllNotFoundException: Unable to load DLL 'System.Data.SQLite.DLL'

Can I fix this easily?

Chris Watts
  • 6,197
  • 7
  • 49
  • 98
  • System.Data.SQLite.dll is not actually managed only. The binary you downloaded uses pinvoke to access sqlite3.dll's unmanaged functions. – Will Apr 13 '12 at 01:06
  • Are you certain about that? I downloaded the binaries labelled 'Managed Only' rather than the normal usage ones. – Chris Watts Apr 13 '12 at 08:11
  • Yes. The System.Data.SQLite people do not do a fully managed one. At some point you still have unmanaged code. Meaning you cannot use System.Data.SQLite without an external dll. – Will Apr 13 '12 at 13:30

1 Answers1

1

This is the only fully managed sqlite3 library I know of.

http://code.google.com/p/csharp-sqlite/

Will
  • 10,013
  • 9
  • 45
  • 77