Unable to Load DLL 'sqlite.interop.dll' After Create Setup File

1

I am working on a windows application using Visual studio 2015(Professional) and Sqlite DataBase, windows 8.1(x64). i Install Sqlite From Nuget it Autometically install These References... system.componentmodel.dataannotations, System.Data.SQLite, System.Data.SQLite.EF6, System.Data.SQLite.Linq .

when i execute my app in visual Studio, Everything is working Fine. then Publish it by Windows Setup. then Install The Newly Created Setup File on My machine windows 8.1(x64). Whenever i try to Run it and Click on Login Button it gives the following error

"unable to load dll 'sqlite.interop.dll': the specified module could not be found. (exception from hresult: 0x8007007e)".

enter image description here

my Code is...

string connectionString = @"Data Source = SampelTest.db; Version = 3; new = false; compress = true; ";    
private void buttonLogin_Click(object sender, EventArgs e)
            {
                using (SQLiteConnection con = new SQLiteConnection(connectionString))
                {
                    try
                    {
                        using (SQLiteCommand sqlcmd = new SQLiteCommand("select count(*) from [SampelTest]", con))
                        {
                            con.Open();
                            Int32 count = Convert.ToInt32(sqlcmd.ExecuteScalar());
                            con.Close();
                            if (count > 0)
                            {
                                MessageBox.Show("User have in DataBase");
                            }
                            else 
                            {
                                MessageBox.Show("Empty DataBase");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {

                    }
                }
            }

My Database file in the Debug Folder "SampelTest.db"i already tried these step that are from Google to resolve my problem.

  1. Coppy Sqlite.Interop.dll File From x64 To Debug Folder. ![enter image description here

  2. create x86 and x64 folder from solution Explorar and add Sqlite.Interop.dll from x86 and x64 respectively and Set Property, Build Option => Content, Copy to output Directory => Copy always.

enter image description here

  1. Unchake the Prefer 32-bit.

enter image description here

After Try these steps can't able to solve this problem. Please Help to me to solve this. Thanks For Looking.

c#
.net
dll
sqlite
asked on Stack Overflow Sep 12, 2018 by Prasenjit Maity

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0