Unable to copy a file from obj\Debug to bin\Debug

后端 未结 30 1436
清歌不尽
清歌不尽 2020-12-02 12:04

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

30条回答
  •  长情又很酷
    2020-12-02 12:47

    This is happening because [yourProjectName].exe process is not closing after finishing debugging.

    There are two solutions to this problem.

    1. Every time you make change to application, Go to Task Manager -> Processes -> [yourProjectName].exe, end this process. You have to end this process every time you make changes to system.

    2. Add a exit button in your application to exit window and add these line to click event

      System.Diagnostics.Process.GetCurrentProcess().Kill();
      Application.Exit();
      

提交回复
热议问题