SQLite with VS2012 and .NET 4.5 — ANY CPU Build

2019-01-26 09:21发布

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:

1条回答
够拽才男人
2楼-- · 2019-01-26 10:20

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.

查看更多
登录 后发表回答