I've had numerous issues with the "wrong" version of SQLite being installed
in the GAC.

eg I make my app x86 and use the x86 SQLite dll and have that in my app
directory.

but the .net framework _always_ prefers to load from the GAC so the the x64
system.data.sqlite is installed my app loads it and chokes... (there is no
proper way to disable this behaviour)

Or if I make a x64 app and the user has the x86 dll installed in the gac,
again my app dies.


After ridiculous amounts of goggling I've discovered that the .net framework
does indeed handle this situation if it is aware of the processor
architecture the DLL is made for.

I've just installed the x86 one and discovered that this installs the
managed assembly as MSIL not x86 or AMD64 and adds the interop assembly
location to the environment path. I guess this it the managed only DLL.

So whichever sqlite.interop.dll it finds first gets loaded, regardless of
architecture. resulting in a BadImageFormatException.

The solution to me it seems is to go back to the mixed mode* (all in one)
assemblies and mark them as x64  / AMD64 respectively for installing into
the GAC  thus allowing the assemblies to be correctly selected
automatically.

in this screenshot you can see that, for example System.data.OracleClient
has two versions, one for x86 and one for AMD64, in this situation the
correct one is always loaded. However Sqlite is registered as MSIL
(universal), which is fine for anything that doesn't utilise amd64 or x86
specific instructions, but causes headaches here.

http://tinypic.com/view.php?pic=27x4eo4&s=7

Could similar be done with SQLite?



- Anthony

*I'm assuming it's not a mixed mode DLL being installed into the GAC
incorrectly as MSIL, that would be really bad...
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to