1
votes

I am not able to create a database using SQLite with my Metro application.

Description: I continue to receive a runtime exception on a failure to load SQLite3.dll.

Observation: I observed that the database directory never gets created in the app package's LocalState directory. After observing this, I literally implemented file path creation at runtime and dropped the sqlite3.dll in the intended location.

Yet, I still receive an exception on failed to load SQLite3.dll.

  1. My CRUD code that leverages SQLite compiles fine.
  2. SQLite dependencies (packages.config, SQLite.cs, and sqlite3.dll) are located in a separate metro class library instead of the application's executable project.
  3. The sqlite3.dll is based on the ARM processor.
  4. The sqlite3.dll is set to Content, Copy Always.

Code:

    SQLiteAsyncConnection connection = new SQLiteAsyncConnection(DATABASE_DIRECTORY_NAME);
    return await connection.CreateTableAsync<Service>();

Please help...

1
\Projects\MyProject\DAL\Local\Infrastructure\sqlite3.dll - Scott Nimrod
Have you tried to put the dll in the same folder as the executable? - quantum
I am successful when I add the DAL assemblies to the metro app executable. However, when I take the same assemblies and dump them into a general Metro class library, the database creation continues to fail. - Scott Nimrod
Perhaps I can create the database in the metro app exe and then try to delegate CRUD operations in a separate project that's specifically responsible for handling DAL operations. - Scott Nimrod

1 Answers

1
votes

I got the same error.After that I have placed sqlite3.dll in my root folder of the project the sqlite3.dll is set to Content, Copy Always. after that it's working