最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - process cannot access file because it is being used by another process - could not copy obj file to bin VS 2022 - Stack Ove

programmeradmin1浏览0评论

I'm just trying to run my windows forms code is visual studio 2022 but it keeps on saying:

Could not copy "obj\Debug\Windows form thing.exe" to "bin\Debug\Windows form thing.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\Windows form thing.exe' because it is being used by another process. The file is locked by: "Windows form thing (1900), Windows form thing (7644), Windows form thing (26568)"

Does anyone know a fix to this?

I'm just trying to run my windows forms code is visual studio 2022 but it keeps on saying:

Could not copy "obj\Debug\Windows form thing.exe" to "bin\Debug\Windows form thing.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\Windows form thing.exe' because it is being used by another process. The file is locked by: "Windows form thing (1900), Windows form thing (7644), Windows form thing (26568)"

Does anyone know a fix to this?

Share Improve this question asked Mar 23 at 12:02 new_programmernew_programmer 213 bronze badges 2
  • 2 This happens often if the application is still running. Just close the application window or click [Stop Debugging] (the red square icon) or hit Shift+F5 in VS. – Olivier Jacot-Descombes Commented Mar 23 at 12:15
  • @new_programmer please follow steps provided in bellow different solutions, and mark one as accepted whatever answer solved your issue and close question or if still not resolve then comment here so others have idea and can suggest more solutions. – Harsh Varde Commented Apr 4 at 14:31
Add a comment  | 

3 Answers 3

Reset to default 0

Looks looks like Visual studio launches 3 processes "Windows form thing (1900), Windows form thing (7644), Windows form thing (26568)".
I think you can try following actions in order

  1. Please stop debugging or running your current project.

    If this did not help please try action 2.

    In rare cases it is required to do step 2.

  2. Close Visual studio and make sure that that processes are gone "Windows form thing (1900), Windows form thing (7644), Windows form thing (26568)". If not you can kill them manually

    Start Visual Studio Again.

  1. If you have started your program in debug mode, then stop debugging:

  2. If you started app w/o debugging, then close your running app from app close button or from task manager, in task manager it will show same name as your project name:

  3. If above 2 options not work then last option is restart your PC, restart always solve most issues :)

Please try the following steps to check if it works for you.

  • Close running app → Check Task Manager → End Windows form thing.exe.

  • Restart VS → Clean Solution (Build → Clean).

  • Delete bin & obj folders manually → Rebuild.

  • Disable VS Hosting Process:

  • Project Properties → Debug → Uncheck "Enable hosting process".

  • Temporarily disable antivirus (if blocking .exe).

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论