1

I am working on a C# project, but when I run my program 2nd time it starts giving below error

Severity Code Description Project File Line Suppression State Error Could not copy "obj\Debug\IsLtd.exe" to "bin\Debug\IsLtd.exe". Exceeded retry count of 10. Failed. The file is locked by: "IsLtd (4584), IsLtd (1168)"IsLtd

I have tried many things to get rid of this but unfortunately couldn't be able to resolve the problem. One temporary solution I get to know is that rename the exe file in the debug folder after every execution.

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    Show us the related code. – LarsTech Sep 03 '19 at 20:52
  • 1
    Most likely, your program does not exit properly. Check if it is still in the task manager or process viewer. – Nico Schertler Sep 03 '19 at 21:06
  • there is nothing wrong in code as per my thoughts ...my program working fine for the first time but for each time after that I need to stop my exe file from task manager...my problem is how can I get rid to manually exit of my exe file for project – Muhammad Usman Sep 04 '19 at 06:40

1 Answers1

0

Severity Code Description Project File Line Suppression State Error Could not copy obj\Debug\IsLtd.exe" to "bin\Debug\IsLtd.exe". Exceeded retry count of 10. Failed. The file is locked by: "IsLtd (4584), IsLtd (1168)"IsLtd

This means that the executable in the debug folder could not be created because it is locked.


Why is it locked?

Because it seems that your application is still running. The hint here is the last part in the message which states that there are still two processes with the ids 4584 and 1168 running.

Markus Safar
  • 6,324
  • 5
  • 28
  • 44