Error message 'Cannot load file or assembly System.Data.SQLite'

Error message 'Cannot load file or assembly System.Data.SQLite'

To overcome this problem in Visual Studio 2010 click Build, then click Configuration Manager. Change the drop down list selection from x86 to AnyCPU. This is most commonly encountered doing a build for an app using SQLite on a 64-bit machine. There are similar challenges with Microsoft Access
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Has anyone tried to build a Setup Project including SQlite ona 64-bit machine:

If so, was the following message encountered
System.Data.SQLite.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'

hi:
Try to change your Target Platform form X86 to AnyCPU in Visual Studio, then rebuild it.

Hello Peter,

in my experience using "Any CPU" as build target produces more problems than it helps.

Therefore I suggest to leave it as "x86" and instead use the x86 version of the "System.Data.SQLite.dll" file of the SQLite .NET package. That should solve the problem.

Best regards
Andreas

In configuration manager (wish I could post a screenshot jpg) we have Active Solution Configuration: Debug and Active Solution Platform: AnyCPU
In the Project Contexts grid below, there are two entries BEISA (the app itself) and BESIASetup (the related Setup/Deployment Project). Both have a Configuration of Debug (which, like Active Solution Configuration above, has a droplist of Debug, Release ...). The fourth column is Build. The
checkbox here for BEISA is checked and there is a checkbox for BeisaSetup (currently unchecked). The THIRD column is Platform. BEISA has
AnyCPU - if one clicks the cell a droplist becomes visible and one can change AnyCPU to x64 or x86. No such droplist for Beisa Setup.

Initially, when BEISA (the app itself) was unchanged it would build successfully but fail at run-time (inside Visual Studio) on a Win 7 64-bit machine as the 64-bit dll for SQLite was deemed incompatible. When you change the Config Manager value to AnyCPU things are fine.

Then it is eventually time for BEISA to grow up, leave home and get bundled in an MSI. That build of the Setup project (to create the MSI) fails.

I'll post some web pages explaining this

Initially, when BEISA (the app itself) was unchanged it would build successfully but fail at run-time (inside Visual Studio) on a Win 7 64-bit machine as the 64-bit dll for SQLite was deemed incompatible. I wrote to the SQLite folks to ask if the 32-bit and 64-bit dlls are actually different (no answer yet).
If different, it gets a little dicey getting the appropriate dll at run-time during debugging (running inside VS). Changing the Config Manager value for the actual project to AnyCPU at least let us test.

In order to create an MSI a sister Setup/Deployment project was assembled in the usual manner. The build of the Setup project (to create the MSI) fails.

Leave a Comment

Please sign in to add a comment. Not a member? Join today