I have a project in C# and I get this error every time I try to compile the project:
(Unable to copy file \"obj\\Debug\\Project1.exe\" to \"bin\\Debug
I struggeled with this since years. I finally downloaded LockHunter to find out who locked the file. In my case it was MBAM. Once I added my project's directory to MBAMs exclusion list, I didn't have this problem anymore.
My Visual studio 2019 suddenly stops and restarts and then when i run project this error comes.
I resolve this issue by going into my project folder and delete bin and obj folder Then clean and rebuild my project. This resolve my issue.
I solved this by killing XDesProc
which had a handle on the DLL it couldn't delete.
Go to your project properties. Inside Build Events, under Pre-build event command line, add these two lines of code:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
After seeing a similar error in visual studios 2012 out of no where. I have found that that going to the root folder of the project and right clicking on it I unchecked read only and this error went away. Apparently TFS sometimes will made a folder read only. Hopefully this will help anyone with a similar issue. Thanks
Mine got solved by: