【问题标题】:can't debug my program anymore无法再调试我的程序
【发布时间】:2011-08-29 15:30:56
【问题描述】:

当我在 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

我怎样才能让它再次工作?

【问题讨论】:

  • 尝试重新启动 SQL 服务器。使用开始-> 运行-> services.msc
  • 某些程序已锁定您的文件。尝试重新启动 vs.net 以检查它是否是 vs.net。如果没有,请查看其他程序使用该程序并注销/重新启动以查看是否有效。
  • 转到您的服务任务管理器结束处理可能正在使用您的 .mdf 文件的应用程序,例如您的管理工作室或其他东西。之后,再次尝试重建您的解决方案。确保没有编译错误。祝你好运!
  • 没有其他程序在使用我的数据库。它仅在 VS 中与项目一起使用。我尝试重新启动 VS 甚至我的计算机。两者都不起作用。

标签: c# mysql winforms compiler-errors


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

    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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 感谢您的回复。手动删除文件然后重建没有成功。我在某个地方找到了这个,它确实有效。在解决方案资源管理器>属性>构建事件中,在“预构建事件命令行”中,del C:\SampleProject\SampleProject\bin\Debug\database.mdf del C:\SampleProject\SampleProject\bin\Debug\database.ldf
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-07
      • 2020-12-07
      • 1970-01-01
      相关资源
      最近更新 更多