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
Before rebuild the solution, clear the project, stop the IIS and open the "bin" folder property. Uncheck the Read-only Attribute in general tab then rebuild.
I had to go into windows explorer and delete the bin/debug folder as well as the obj/debug folders. Then I cleaned & rebuilt the project.
Rename the assembly to a different name to solve this issue.
Disable any Anti Ransomware
(like MalwareBytes
) running, then the problem should be solved.
Well i have the same problem, my way to fix it was to stop and disable the "application experience" service in Windows.
Solution1:
Solution2:
Add the following code in pre-build event:
attrib -r $(OutDir)*..\* /s
This command line code will remove the ready-only attribute of "bin" folder. Now visual studio can easily delete and copy new dlls.