64-bit SQLite.dll and Any CPU

旧巷老猫 提交于 2019-12-29 00:43:24

问题


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


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/6503634/64-bit-sqlite-dll-and-any-cpu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!