SQLite.Interop无法删除文件清理的解决方案 [英] SQLite.Interop unable to delete file on clean of solution

查看:1346
本文介绍了SQLite.Interop无法删除文件清理的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MVC Web应用程序中使用Nuget包 System.Data.SQLite 。当我尝试清理解决方案并重建时,似乎存在锁定问题。我得到的错误消息是:
无法删除文件bin\x64\SQLite.Interop.dll。访问路径\bin\x64\SQLite.Interop.dll被拒绝。

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.

我在想数据库仍然是打开的,或者.dll仍在使用中,但是我找不到任何文档或任何对同样问题的引用。此问题似乎是类似的问题,但不提供解决方案对我的问题。

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.

这是一个代码段,我用来写入SQLite数据库:

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();

是否需要另一步骤才能正确关闭与数据库的连接,并通知dll并且连接具有关闭?

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

我在这个数据解决方案中使用了这个代码,我已经添加到nuget包中,并在另一个解决方案中使用。在构建/清理使用nuget包的解决方案时,我只遇到这个问题。

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.

推荐答案

根据Eric指出的链接,杀死IIS Express过程可以解决我的错误。我正在使用Visual Studio 2015社区。我从任务栏退出IIS Express进程。

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.

这篇关于SQLite.Interop无法删除文件清理的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆