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

后端 未结 30 1210
清歌不尽
清歌不尽 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:45
    1. Close your project
    2. Delete bin folder

    i find it work, :)

    0 讨论(0)
  • 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();
      
    0 讨论(0)
  • 2020-12-02 12:47

    This happened to me at VS 2010 and Win 7.. Case :

    • I can not Rebuild with Debug Configuration manager, but I can rebuild with Release Configuration manager

    debug

    What I have tried:

    • Check my account type at control panel - user account --> My Account is Administrator

    cpanel

    • Set the bin folder not read only

    not read only

    • Add security at bin folder to Everyone

    everyone

    • stop the iis server

    iis stop

    • Stop antivirus, check ridiculous running program using task manager and ProcessExplorer

    • run VS as administrator

    If All that way is still not working.

    Then, the last way to try:

    • close solution
    • close visual studio
    • start - shutdown
    • press power button to turn on the computer
    • login to your account which has administrator previlege at user type
    • reopen solution
    • rebuild
    • that way working. All people call this way as Reset Computer
    0 讨论(0)
  • 2020-12-02 12:47

    Run Visual Studio as Administrator

    0 讨论(0)
  • 2020-12-02 12:47

    We recently experienced this on a WinPhone 8 project, in VS 2012 Update 2.

    Inexplicably, the cause was using the Tuple type. Removing the code that used a Tuple the problem went away. Add the code back the problem returned.

    0 讨论(0)
  • 2020-12-02 12:50

    If you look in the obj directory, and you don't see your .exe, it's possible that Avast! or other antivirus is deleting it. I would actually see the .exe show up and then disappear. As soon as I turned off Avast!, problem solved.

    VS2010 throwing "Could not copy the file "obj\x86\Debug\[file].exe" because it was not found."

    0 讨论(0)
提交回复
热议问题