0
votes

I am trying to use SQLITE library with winforms solution, but its throwing an odd error saying :

" Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"

here is snippet code:

 internal string GetUserAppPath()
        {
            string dir = configure.appDir();
            try
            {
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                string dbPath = configure.dbFile();

                if (!File.Exists(dbPath))
                {
                    SQLiteConnection.CreateFile(dbPath);
                    SQLiteConnection cn = new SQLiteConnection("Data Source=" + dbPath);
                    SQLiteCommand scriptcommand = new SQLiteCommand(cn);


                    scriptcommand.CommandText = CustomSolution.Properties.Resources.DatabaseScript;

                    cn.Open();
                    scriptcommand.ExecuteNonQuery();
                    cn.Close();

                }
                DBfildir = "Data Source=" + dbPath;
            }
            catch (System.Exception ex)
            {
                //MessageBox.Show(x.Message);

            }
            return dir;
        }
1

1 Answers

0
votes

Cant comment yet:

you can install them through nuget:

PM> Install-Package System.Data.SQLite

use the -Version 1.0.66 to specify a specific version eg 1.0.66

Just a few more question to understand your environment:

  • Did you add/install the SQLite package to your solution?
  • are the compiled dll's copied to your output folder when building?
  • double check your project refrences to make sure they are not marked as missing?