Reputation: 93
I keep getting this error message when I try to compile my app:
Error 1 Unable to copy file "obj\x86\Debug\WpfApplication1.exe" to "bin\Debug\WpfApplication1.exe". The process cannot access the file 'bin\Debug\WpfApplication1.exe' because it is being used by another process. WpfApplication1
Upvotes: 2
Views: 301
Reputation: 437
Try this its work for me just clean your solution and then Build Solution.
Upvotes: 0
Reputation: 17359
Like it states, some process is using that file. Restarting Visual Studio might not be enough.
This happens to me sometimes because Avast Antivirus tries to scan and do whatever else it does to the exe of my application, and for some reason does not release it later.
One option would be to restart the computer.
Another would be to use something like Process Explorer and use it to release the handle on that file.
Using Process Explorer, you can release the file using this steps:
Upvotes: 1
Reputation: 156918
Try to close Visual Studio and try again. Maybe you need to close the vshost program using Task Manager.
Sometimes the files get locked, but usually they are freed by closing and reopening Visual Studio.
Also see this question on SO
Upvotes: 1
Reputation: 6007
You still have your application running. Check if there are no processes hanging in taskmgr. If not, close MSVS, delete bin
and obj
folders, reopen MSVS and try again.
Upvotes: 3