简体   繁体   中英

How can I package a DLL without managed code into my WPF app?

I've been using LibZ Container for awhile now to bundle DLL files together with my executables, resulting in only needing to copy a single executable file instead of installing a bunch of DLLs. (For those not familiar LibZ Container is an alternative to IL Merge, only that it works with WPF.)

Normally this works great, but today I learned that it doesn't work so great with the SQLite library. In particular, there's one file that fails to package. This is the error message that I get:

Loading '.\\SQLite.Interop.dll'

Failed to load assembly from '.\\SQLite.Interop.dll'

Assembly '.\\SQLite.Interop.dll' could not be loaded

Looking on the SQLite FAQ page I see they state this:

Do I need to add an assembly reference to the "sqlite3.dll" or "SQLite.Interop.dll" in my project?

No, because they are not managed assemblies and contain no managed code.

I must confess I'm not really sure what that means... until now this stuff has mostly been a black box to me that just sort of works. Is there any way to bundle the SQLite.Interop.dll file with the assembly like I'm hoping? Can anyone offer an explanation of why LibZ Container is choking on this DLL file in particular?

Long story short, as Ron already suggested in the comments, this is not possible. Because the two SQLite.Interop.dll files are unmanaged, they can't be bundled inside the executable. They have to stay outside, in their respective x86 and x64 folders, within the same parent directory as the executable. No way around this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM