8

I'm using the Nuget package System.Data.SQLite in an MVC web application. There seems to be lock issue when I try to clean the solution and rebuild. The error message I get is: Unable to delete file "bin\x64\SQLite.Interop.dll". Access to the path '\bin\x64\SQLite.Interop.dll' is denied.

I'm thinking that the database is either still open or that the .dll is still in use, but I can't find any documentation or any reference to the same problem. This question seems like a similar issue but doesn't provide a resolution to my problem.

Here is a code snippet that I'm using to write to the SQLite database:

        var conn = new SQLiteConnection("Data Source=" + connectionString);
        conn.Open();

        var debugEntriesTableQuery = "CREATE TABLE ...";

        var cmd = conn.CreateCommand();

        cmd.CommandText = debugEntriesTableQuery;

        cmd.ExecuteNonQuery();

        conn.Close();

Is there another step needed to properly close the connection to the database and inform the dll and the connection has closed?

I am using this code inside a data solution that I have added to a nuget package and am using in another solution. I am only having this problem when building/cleaning the solution that is using my nuget package.

Community
  • 1
  • 1
mem27
  • 233
  • 2
  • 12

1 Answers1

1

Killing the IIS Express process solves this error for me as pointed out by the link Eric points to. I am using Visual Studio 2015 community. I exit the IIS Express process from the taskbar.

enter image description here

enter image description here

AJ Dhaliwal
  • 661
  • 1
  • 8
  • 24