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

后端 未结 30 1212
清歌不尽
清歌不尽 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:42

    I struggeled with this since years. I finally downloaded LockHunter to find out who locked the file. In my case it was MBAM. Once I added my project's directory to MBAMs exclusion list, I didn't have this problem anymore.

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

    My Visual studio 2019 suddenly stops and restarts and then when i run project this error comes.

    I resolve this issue by going into my project folder and delete bin and obj folder Then clean and rebuild my project. This resolve my issue.

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

    I solved this by killing XDesProc which had a handle on the DLL it couldn't delete.

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

    This should work.

    Go to your project properties. Inside Build Events, under Pre-build event command line, add these two lines of code:

    if exist "$(TargetPath).locked" del "$(TargetPath).locked"
    if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
    
    0 讨论(0)
  • 2020-12-02 12:44

    After seeing a similar error in visual studios 2012 out of no where. I have found that that going to the root folder of the project and right clicking on it I unchecked read only and this error went away. Apparently TFS sometimes will made a folder read only. Hopefully this will help anyone with a similar issue. Thanks

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

    Mine got solved by:

    1. Clean solution
    2. Close all processes depending on VS (Current instances).
    3. Rebuild
    0 讨论(0)
提交回复
热议问题