14
votes

I'm distributing System.Data.Sqlite.dll which I integrated into my project using NUGET.

I'm releasing my application as x86.

If I simply distribute System.Data.Sqlite.dll to my application folder, my application crashes.

When I distribute the file "SQLite.Interop.dll", which VS places into bin\x86\Release\x86\ at compile time, my application doesn't crash anymore, and everything works fine.

However, I don't want to distribute the Interop dll. Therefore I right-click the reference System.Data.Sqlite in my solution and set "Embed Interop Type" to "True".

Now Visual Studio doesn't want to compile my application anymore, telling me

A reference to SQLiteCommand class isn't valid when the assembly is configured to embed Interop types.

Do I really have to distribute Sqlite.Interop.dll, or can I solve this is an elegant way?

2
You can download bundle package from here. Them contains mixed-mode assembly which embed native components in managed assembly. - user4003407

2 Answers

0
votes

if we are setting "Embed Interop Type" to "False" it will work fine.

otherwise refer this document

0
votes

Use the SQLitePCL*.* nugets (SQLitePCL.raw for .net 4.0 support).