SQLite.Interop cannot delete file cleared of solution

I am using the Nuget System.Data.SQLite package in an MVC web application. There seems to be a lock problem when I try to clear 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. Unable to delete file "bin\x64\SQLite.Interop.dll". Access to the path '\bin\x64\SQLite.Interop.dll' is denied.

I think the database is still open or that the .dll is still in use, but I cannot find any documentation or links to the same problem. This question seems like a similar problem, but does not provide a solution to my problem.

Here is the code snippet that I use 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 necessary to properly close the database connection and inform the DLL, and the connection is closed?

I use this code inside a data solution that I added to the nuget package and use it in another solution. I only have this problem when creating / cleaning a solution using my nuget package.

+6
source share
1 answer

Killing the IIS Express process solves this error for me, as indicated in the link that Eric points to. I am using the Visual Studio 2015 community. I exit the IIS Express process from the taskbar.

0
source

Source: https://habr.com/ru/post/978799/


All Articles