I have the Visual Studio 2010 premium installed (iam a student and I have the vs2010 installed from our msdnaa). I wrote a small windows form application.

When I try to compile and run the program using F5, the green start button turns off for 3-5 seconds, then I get an error :

The file "obj\x86\Debug\Test.exe" cannot be copied into "bin\Debug\Test.exe".

The process cannot access the file "bin\debug\Test.exe", because it is used from other process. (Please note that I translated the error message from German)

To solve this problem, I do have to go to the debug folder and delete the Test.exe file, then recompile the Program (hitting F5) but this won`t start the debugging,I do have to start the program from Test.exe from the bin\Debug folder.

How can I solve this problem?

It is annoying then I don't have any chance to debug anymore, and also it takes too much time to delete the file, then start it again after building it.

Please help, I did tried to reinstall the VS2010 again, but this didn't help.

  • Are you using source control? – David Chen Aug 28 '11 at 21:34
  • Do you have an anti-virus running? – user3463 Aug 28 '11 at 21:44
  • 1
    Should this be migrated to Stack Overflow as it is a programming issue, or leave it here because it is an application issue? – Wayne Aug 29 '11 at 7:42

Your usually get this type of error message from VS 2010 when your application hangs or is still executing and you didn't close it. I recommend trying the following variants:

  • 1) make a new empty project and try to see if you have the same F5 problem. If yes proceed to the next point, if no then your application is hanging
  • 2) try saving the project file in a different location (on a diferent drive or a diferent folder). Or
  • 3) check if VS2010 has DELETE rights on that path, if not, add that right and then you should have no souch problem

Hope that helps,

  • +1 for the delete rights, did not think of getting down at that level (besides the file having a lock by a background running thread...) – Wayne Sep 1 '11 at 3:15

First I would install SP1 for Visual Studio if you have not done so already.

Either use the Web Based Installer or the Full ISO Download to install.

If the problem still exists, you may want to see if starting Visual Studio with any add-ins disabled and see if that fixes the issue and narrows down the culprit.

Update #1: Ensure your application is not running and you have no background threads still executing (thus causing the file to be locked)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.