2011-08-29 57 views
1

雖然我在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 

我該如何再次使用它?

+0

嘗試重新啓動SQL Server。使用開始 - >運行 - > services.msc – Johan

+0

某些程序已鎖定您的文件。嘗試重新啓動vs.net以檢查它是否爲vs.net。如果沒有,請查看其他程序使用該程序以及註銷/重新啓動以查看該程序是否有效。 – Peter

+0

轉到服務任務管理器結束處理可能正在使用.mdf文件(如管理工作室或其他應用程序)的應用程序。之後,請嘗試再次重建您的解決方案。確保沒有編譯錯誤。祝你好運! – vinayvasyani

回答

0

原始文件似乎被鎖定,因此無法重建。如果你有某種文件解鎖器,那應該可以工作。否則,只需從當前位置刪除它們,並在下一次嘗試以調試模式運行時重建它們。

+0

感謝您的回覆。手動刪除文件然後重建不起作用。我發現這個地方,它確實工作。 在解決方案資源管理>屬性>生成事件, 在 '預生成事件命令行', 刪除C:\ SampleProject \ SampleProject \ BIN \調試\ database.mdf 刪除C:\ SampleProject \ SampleProject \ BIN \調試\ database.ldf – Lihini

2

文件被另一個進程鎖定。 Handle是一個Windows/SysInternals工具,可以幫助解決這個問題。它會告訴你什麼進程正在使用這些文件。

下載句柄,進入命令提示符並鍵入「句柄」C:\ Users \ Nihal \ Documents \ Visual Studio 2005'「。

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

相關問題