简体   繁体   中英

Unable to copy file .exe in Visual Studio 2017

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?

Go to Task Manager and look for Microsoft vshost .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.

Close the application and delete Obj and bin folder

First, make sure you have the .net core localhost server stopped, before trying to build the solution.

I have seen this error before. Trying the following has worked for me:

1. Close the current solution.
2. Close Visual Studio.
3. Start Visual Studio in Administrator mode.
4. Re-open and build the solution.

The above can avoid the common copy file and file Access Denied errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM