Using SQLite in 64-bit .NET environments

by Benny 12. October 2009 17:48

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:

  1. Go to the startup project of your program. 
  2. Open the properties window.
  3. Click the compile tab.
  4. Click advanced compile options.
  5. 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

Tags:

Software Development

Comments

10/14/2009 1:56:39 PM #

pingback

Pingback from jasper22.wordpress.com

Using SQLite in 64-bit .NET environments « Jasper Blog

jasper22.wordpress.com

2/11/2010 8:02:44 AM #

trackback

System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite'

System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite'

Marcus Hammarberg

2/28/2010 7:49:24 PM #

Fatcow

Should I get a VPS? Right now I am using shared hosting but they keep disabling my account due to high server overload. Im getting about 4,000 UV a day. What brand should I get?

Fatcow United States

3/5/2010 1:54:50 AM #

Raymond Gonzalez

Wow, i cant believe every other blog out there is filled with so much spam, can you guys do something about this? Just wanted to say you have a nice blog, what are you using for combating comment spam?

Raymond Gonzalez United States

3/6/2010 1:48:55 AM #

Coralie Infantino

this is my first time visiting your web-site and i'm impress can really see myself starting to be a frequent visitor, awesome post

Coralie Infantino United States

3/9/2010 6:49:25 PM #

seo tools

It's not that I would like to copy your blog, but I really like the look. would you tell me what template are you using? Or is it made especially for you?

seo tools Slovenia

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

Recent Posts

Page List

Recent Comments

Comment RSS