2

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

1
  • when i got this error, clean and rebuild usually fix it Commented Jan 8, 2014 at 14:21

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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:

  1. Find->File Handle or DLL...
  2. In the dialog that opens search for the file and select it
  3. Close the dialog and in the main window on the selected process right click and Kill Process.

2 Comments

99,9% sure that restarting the computer is going to fix the issue
@Alex Yeah, I wrote that as first option, but it should probably be used only as a last resort :)
1

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

Comments

0

Try this its work for me just clean your solution and then Build Solution.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.