Using SQLite in 64-bit .NET environments

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

October 2009 bookshelf

Sams Teach Yourself WPF in 24 Hours

I’m in the process of creating an application for a friend of mine who is starting his own company. He needs a little CMS system to support his business in the advertising world. He gave me a nice layout to use in the application so WPF seemed to be the best option. I jumped right in only to find that it was more complex than I first expected. After looking around what was available I decided to go for this book since it’s co-authored by Rob Eisenberg who is in charge of the Caliburn framework.

I’m just passed the first part of the book which introduces the layout containers (grid, stackpanel, wrappanel,…) and the basic containers. It already helped me getting the layout right for the application I’m writing. Also the code snippets in the book are in colour which certainly improves the readability of especially the XAML.

The Art of Unit Testing: with Examples in .NET

Though I’m convinced of TDD and unit testing in general I find it hard to apply when doing projects at work. I’m hoping this book will help me to structure my programming work around TDD and how to write good maintainable tests. The text is written in an easy to read manner and currently feels like a step by step guide on how to become a better test writer. You don’t need any prior knowledge to get started with this book. I’ve only read the first 100 pages but in my eyes it’s already a classic, go get it.

Dependecy Injection in .NET

Earlier this week you could get this one for a mere $10 via a twitter promo code. Though I’m fairly confident I know what DI is, when to use it and what the advantages are you always need to keep an eye out for any new insights or information. Have only read the first couple of pages where the problem of coupling between your components is sketched. The book is still a work in progress, but you can already get it via the Early Access Program.