Could not copy the file “obj\Debug\app.exe” because it was not found

I was in the middle of working on a project and I suddenly started getting the following error:

I tried a complete clean and rebuild. I even tried scorching my workspace but the error would not go away. I read that it might be a problem with Visual Studio extensions so I disabled all my extensions, but no luck.

I then started watching the obj\Debug folder as I did a build. Turns out that the .exe file was getting written, but then it would immediately be deleted before the build could finish. Then I found this:

It turns out that Avast anti-virus thought my program was suspicious and was quarantining it during the build process.  Adding an exclusion for my entire source tree solved this issue.

Next time, I’ll discuss how to solve the issue when installing this same application.

2 thoughts on “Could not copy the file “obj\Debug\app.exe” because it was not found

  1. That was it! I can’t find how to add exclusion for folder in Avast (I have different language and different interface than is used in examples on the internet) so turning off Avast do it for me. Thanks.

    • To add an exculsion go to
      settings->Antivirus
      in the exclusion section of the folder, click browse and select the folder you want to add to exclusion

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>