I\'ve been having this problem for a while now. I created a brand new winforms c# application in Visual Studio. I can usually launch it in debug mode once without a problem.
Symantec Endpoint Protection caused this on my pc. It had quarantined the output folder (set it to readonly), believing it was infected.
Had this problem on Windows 10 and it was coming from Windows Defender Antivirus.
I excluded the folder containing the .exe
file and it worked again.
You can do that in Windows Security > Virus & threat protection settings > Exclusions
Have you tried running VS as an administrator? I've run into this problem recently and searched online to see if anyone has found an answer to it. The only thing I do that works is run as an administrator, but I hate having to do that.
[edit] I just read a subsequent comment by someone else about turning on Application Experience in services. That seems to have fixed it for me. I've been running on Windows client for years and just recently switched to Windows Server, which explains why I hadn't run into it before.
First check to see if you can delete the EXE. If you can't that means some process has a handle on it.
Run Process Explorer and do a search for TestApplication.exe to find what it is
Do you have your bin folder included in your svn? In general, you shouldn't do this, for exacly this reason.
These folders - bin and obj - are generated by VS, and so shoudl be regenerated if you check out the code again.
You can Run a program called Unlocker.exe which is a small program which unlocks the locked program.
Try to unlock the exe which is locked and it will give you the exact program which is locking it.
This will help you pin point the problem.