Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

c# - SQLite with VS2012 and .NET 4.5 -- ANY CPU Build

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:

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...