When you download the binaries from the SQLite site you’ll notice that there are specific versions for different environments. While I used the 32 bit version on my Vista 64-bit machine in the past, or at least I think I did, I ran into problems with them when I migrated to Windows 7.
Turns out that some code in the 32-bit library can’t run on a 64-bit version for reasons that probably matter but are unknown to me.
.NET applications run natively in 32 or 64-bit mode depending on your system by default, if you keep your compile settings unchanged. The only way to use 32-bit libraries, that have specific 32-bit dependencies, is to change your compile settings or use a tool that ships with Visual Studio / the SDK.(CoreFlags.exe)
To change your compile settings in Visual Studio:
- Go to the startup project of your program.
- Open the properties window.
- Click the compile tab.
- Click advanced compile options.
- Change the target CPU options to x86.
Your program will now always run in 32 bit mode, even when run on a 64 bit machine.
You could also provide two distributions, one for each environment. While this will become the standard in the future, for my current project this was the best and easiest option.
More info can be found here: Running .NET Apps in 32-bit mode on 64-bit Windows, MSDN: 64-bit Applications, Visual Studio Development Environment 64-Bit Support, forum post at the SQLite site