8

I've tried looking through the answers for related questions, but haven't found anything that isn't a few years old (unsure if they are still the go-to answer) or that answers my question fully.

Requirements:

Unfortunately, the DLLs are split into 32-bit or 64-bit releases.

Questions:

  • Is it possible to include both DLLs and switch over them based on processor? How do I do this?
  • I've read a bit about the GAC, and from what I've read, it's a local solution. To implement this for my application I'd have to install the DLLs to the GAC for every installation, correct?
  • Can I force the program to run in 32-bit mode in a 64-bit environment, thus losing the 64-bit advantages but being able to run my program in both environments without issue?

Some possible answers that I'm unsure would work for my situation:

Community
  • 1
  • 1
CODe
  • 2,253
  • 6
  • 36
  • 65

1 Answers1

13

Yes. Just use the NuGet package System.Data.SQLite. It will install an x86 and x64 subdirectory into your project and, when compiled, into your bin. The 32 bit and 64 bit interop DLLs are copied into those and selected appropriately at runtime based on your CPU. So you build with "Any CPU" selected and can run your application on 32 or 64 bit Windows.

Tyler Jensen
  • 795
  • 4
  • 9
  • Thanks a lot, glad nuget created this since SQLite split up their DLLs. Is it possible to get the VS2012 Design Components installed using this? Not a necessity, but it would be nice. – CODe Oct 27 '13 at 21:37
  • Don't know about design components. I gave those up long ago. Clarification. It was not NuGet that put it up. NuGet.org hosts it but is was the guys at sqlite.org who created the package. – Tyler Jensen Oct 27 '13 at 22:31
  • Oh, I see. I've seen elsewhere about the nuget DLLs and assumed wrong, glad to see the sqlite developers are making it easy to do mixed mode. – CODe Oct 27 '13 at 23:28
  • "and, when compiled, into your bin" - that doesn't seem to be quite true. When I install that NuGet package in my project, the DLLs in the x86/x64 subfolders are not found (not even if I set the files to be copied upon compilation, which does *not* happen automatically, either). – O. R. Mapper Mar 17 '14 at 02:03
  • That is weird. I have not experienced that. – Tyler Jensen Mar 18 '14 at 03:09
  • @TylerJensen i have installed sqlite from nuget but i am still gettting error of x32 and x64 – Meer Apr 02 '16 at 11:24
  • @MeerDeen I've been away from SO for a long time. Did you find the answer to your question? – Tyler Jensen Aug 23 '16 at 20:19
  • I know this was awhile ago but make sure `Copy Local` is set to true on the native and the SqlIte dlls. – Colin Bull Mar 27 '17 at 12:08