How to let SQLite.NET support Windows x64 with .NET 4.0
Posted by Admin L in .NET Programming on 16-07-2011. Tags: .NET Programming Experience
Author: Nosa Lee
Original Address: https://www.seeksunslowly.com/sqlite-net-x64-net4
To reprint this article, please indicate the source, thank you.
_____________________________________
The DLL in current version of SQLite.NET (1.0.66.0) is not compatible in Windows x64 with .NET 4.0, in fact, the binary package of SQLite.NET contains a x64 version DLL, it is compatible in Windows x64 + .NET 4.0 perfectly.
But you may hope your program is compatible in Windows x86 and Windows x64 both, how to achieve it?
I will tell you an easy and right way to do this:
1. Extract bin\System.Data.SQLite.dll (for Windows x86) and bin\x64\System.Data.SQLite.dll (for Windows x64) from SQLite-1.0.66.0-binaries.zip, and rename them to System.Data.SQLite.32.dll and System.Data.SQLite.64.dll.
2. Copy them to your program folder, and determine Windows is 32-bit or 64-bit at program initialization (before load System.Data.SQLite.dll, please refer to How to determine Windows OS is 32-bit or 64-bit in .NET), if it is 32-bit, then execute “copy System.Data.SQLite.32.dll System.Data.SQLite.dll” action, else execute “copy System.Data.SQLite.64.dll System.Data.SQLite.dll”.
As so, your application can still run perfectly on 32-bit Windows or Windows x64 with .NET 2.0, 3.0, 3.5 or .NET 4.0.


