无法再调试我的程序

时间:2011-08-29 15:30:56

标签: c# mysql winforms compiler-errors

当我在C#.NET上开展一个项目时,我遇到了电源故障,现在我无法调试我的程序。这些是发生的错误。

Error   1   Unable to copy file "C:\Users\Nihal\Documents\Visual Studio 2005\Projects\InfortecManagementSystem\InfortecManagementSystem\InfortecInternational.mdf" to "bin\Debug\InfortecInternational.mdf". The process cannot access the file 'C:\Users\Nihal\Documents\Visual Studio 2005\Projects\InfortecManagementSystem\InfortecManagementSystem\InfortecInternational.mdf' because it is being used by another process. InfortecManagementSystem

Error   2   Unable to copy file "C:\Users\Nihal\Documents\Visual Studio 2005\Projects\InfortecManagementSystem\InfortecManagementSystem\InfortecInternational_log.ldf" to "bin\Debug\InfortecInternational_log.ldf". The process cannot access the file 'C:\Users\Nihal\Documents\Visual Studio 2005\Projects\InfortecManagementSystem\InfortecManagementSystem\InfortecInternational_log.ldf' because it is being used by another process. InfortecManagementSystem

如何让它再次运作?

3 个答案:

答案 0 :(得分:2)

文件被另一个进程锁定。 Handle是Windows / SysInternals工具,可帮助解决此问题。它会告诉您当前正在使用这些文件的进程。

下载句柄,转到命令提示符并输入“handle”C:\ Users \ Nihal \ Documents \ Visual Studio 2005'“。

答案 1 :(得分:1)

感谢您的回复。手动删除文件然后重建没有成功。我在某个地方找到了它并且确实有效。

In Solution Explorer>Properties>Build Events,
In 'Pre-build event command line',

    del C: \ SampleProject \ SampleProject \ bin \ Debug \ database.mdf 
    del C: \ SampleProject \ SampleProject \ bin \ Debug \ database.ldf

这是the link

答案 2 :(得分:0)

原始文件似乎已锁定,因此无法重建。如果您有某种文件解锁器,那应该可行。否则,只需将它们从当前位置删除,并允许在下次尝试以调试模式运行时重建它们。