64-bit SQLite.dll and Any CPU

2019-01-19 23:52发布

I finally decided to post a question here after some time spent trying to figure out this problem. A few days ago I posted this same question on sqlite forum but that website is currently not available . http://sqlite.phxsoftware.com/forums/t/2669.aspx

So, here is the question: I have 64-bit computer with 64-bit OS. A co-worker has 64-bit computer with 32-bit OS. We develop a web application that brings a lot of data from server and keeps it in memory SQLite database, so everything can run faster. Right now we use 32-bit SQLite.dll on both machines. However we want to switch to 64-bit dll (and increase amount of data we can use and store). I have downloaded from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki folowing files: sqlite-dotnet-x64-1007300.exe and instaled on my machine. I have placed System.Data.Sqlite.dll and System.Data.Sqlite.Linq.dll into lib folder, while I have copied Sqlite.Interop.dll into bin\Debug folder. When I debug application by using Any CPU everything works fine on my machine, however, my co-worker is getting errors.

I want to use 64-bit dll and build exe file using Any CPU and not worry if the system is 32 or 64. Is that possible? And if it is what I should do to accomplish that? Thanks in advance!

P.S. We use C# - Visual Studio 2008 3.5 SP1

3条回答
看我几分像从前
2楼-- · 2019-01-20 00:03

Today, you don't have to any more. Just make sure you bundle both interop DLLs like this:

path_to_exe\System.Data.SQLite.dll
path_to_exe\x64\SQLite.Interop.dll
path_to_exe\x86\SQLite.Interop.dll

and the System.Data.SQLite.dll will find the correct one depending on the platform.

查看更多
Luminary・发光体
3楼-- · 2019-01-20 00:07

Just install it from nuget. It will install both builds and they will be copied in separate folders and used based on the target system. Just set your build mode to Any CPU and you are good to go!
From here.

查看更多
\"骚年 ilove
4楼-- · 2019-01-20 00:25

I guess that you'll have to ship both 32 bit and 64 bit SQLite.dlls, and install one or the other depending on the target system architecture.

查看更多
登录 后发表回答