Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
1.40/5 (4 votes)
See more:
Hi friends
I have two issue in my project.
1.Error143Could not copy "obj\Debug\LibrarySystem.exe" to "bin\Debug\LibrarySystem.exe". Exceeded retry count of 10. Failed.
2.Error144Unable to copy file "obj\Debug\LibrarySystem.exe" to "bin\Debug\LibrarySystem.exe". The process cannot access the file 'bin\Debug\LibrarySystem.exe' because it is being used by another process.

I have tried with add the following in the build event.
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

it worked for me once. but next time same error occur. how can solve this problem.
Updated 18-Aug-22 0:04am
ZurdoDev 13-May-13 11:36am    
The error says something still has it open. What has it open? Are you running it?
Sergey Alexandrovich Kryukov 13-May-13 13:15pm    
Chances are, you project structure is wrong. Or, do you run two instances of Visual Studio? It would be possible, but you should clearly understand all the consequences.
Volynsky Alex 13-May-13 15:59pm    
Tell me, please if you running your VS as Administrator ?
Volynsky Alex 13-May-13 16:02pm    
Maybe you use your VS on VMware ?

Go to task manager and check if there are any additional MSBuild processes running.
I had this scenario and realised MSBuild had not closed down and was holding the exe.
Share this answer
nika2008 16-Sep-15 6:59am    
thnx +5 :)
There are two issue which are possible.
1) You don't have access to debug folder (unlikely but possible). Just run the dev environment as admin.
2. The exe in debug is still running => Goto Task manager and kill the executable (LibrarySystem.exe).
Share this answer
CHill60 6-Dec-18 8:03am    
Strictly speaking it should be LibrarySystem.vhost.exe that needs killing
right click folder and uncheck readonly
Share this answer
I had the same problem in Visual Studio 2013. After installation of Visual Studio Update 5, the problem is resolved.
Share this answer
CHill60 6-Dec-18 8:02am    
And when it happens again (which is just as likely) then try Solution 3
Close the program and relaunch it. Worked for me.
Share this answer
My solution is to delete your exe in debug folder. Also to stop process in task mangager. That evry time helps me;)! Also, if this doesn't work run VS in Administrator
Share this answer
if your application name is myapp then go to command prompet and issue the command

taskkill /IM myapp.exe /F
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900