Issue
I have an asp.net core project that references .NET Framework and I’m using Visual Studio 2017 Enterprise. When I try to build my solution, I came across with this error:
Unable to copy file "obj\Debug\net461\MyProject.exe" to "bin\Debug\net461\MyProject.exe".
Access to the path 'bin\Debug\net461\MyProject.exe' is denied.
Even if I cleaned the solution and build again, I still have this error.
Anyone faced this error?
Solution
Go to Task Manager and look for Microsoftvshost.exe and kill them all. Even though you stop debugging the exe can continue to run in the background. This causes a lock on the file.
Answered By – Ottak
Answer Checked By – Dawn Plyler (BugsFixing Volunteer)