带有 VS2012 和 .NET 4.5 的 SQLite——任何 CPU 构建 [英] SQLite with VS2012 and .NET 4.5 -- ANY CPU Build

查看:28
本文介绍了带有 VS2012 和 .NET 4.5 的 SQLite——任何 CPU 构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试查看相关问题的答案,但没有找到任何不是几年前的(不确定它们是否仍然是首选答案)或完全回答我的问题的内容.

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.

要求:

不幸的是,DLL 分为 32 位或 64 位版本.

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

问题:

  • 是否可以包含两个 DLL 并根据处理器切换它们?我该怎么做?
  • 我读过一些关于 GAC 的内容,从我读到的内容来看,这是一个本地解决方案.要为我的应用程序实现这一点,我必须在每次安装时将 DLL 安装到 GAC,对吗?
  • 我是否可以强制程序在 64 位环境中以 32 位模式运行,从而失去 64 位优势,但能够在两种环境中运行我的程序而不会出现问题?

一些我不确定是否适合我的情况的可能答案:

推荐答案

是的.只需使用 NuGet 包 System.Data.SQLite.它会将 x86 和 x64 子目录安装到您的项目中,并在编译后安装到您的 bin 中.The 32 bit and 64 bit interop DLLs are copied into those and selected appropriately at runtime based on your CPU.因此,您选择任何 CPU"进行构建,并且可以在 32 位或 64 位 Windows 上运行您的应用程序.

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.

这篇关于带有 VS2012 和 .NET 4.5 的 SQLite——任何 CPU 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆