System.Data.SQLite specific reference platform
I am using SQLite for unit testing and can use it as a database for local development / stage.
System.Data.SQLite has mainly 2 versions: x86 and x64. The correct one should be used for a specific platform.
I have 64-bit Win7, other guys on the team can use 32-bit OS. The server platform is not known at this stage.
If I use a 32-bit build on a 64-bit platform I get BadImageFormatException: Could not load file or assembly 'System.Data.SQLite'
. I believe this will happen when trying to use a 64-bit build on a 32-bit platform.
So my question is, is this the best way to reference a SQLite assembly so that it is platform independent and people can just use it?
It is possible to use a 32-bit build on a 64-bit platform (maybe there is a switch for that?).
a source to share
If it is installed in the GAC, you simply reference the assembly and the system will pick the correct one.
Otherwise, you need to make sure you link to the correct "manually" (in the past I used a build system that copied the correct version to the "deploy" folder when building. These days, everything I do is 64-bit, so this not such a big deal).
Alternatively, you can build your application as x86 and then only use the 32-bit version. In the project properties under the Build tab, set the Platform Target to "x86". You only need to do it with executables: the DLL can still be AnyCPU.
a source to share