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

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

    The real problem isn't the error you're getting; it's that the application isn't cleaning up after itself.

    It's either holding on to references, not freeing resources, or something else that's causing the process to not end when it's being told to close. Fix up that issue and this problem will resolve itself. We can't really help you with that unless you post your code (and at this point, if you need help with that, you should start a new question).

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

    I had same problem, after read your answers , went to Task Manager and searched for app.exe because i believe maybe it doesn't close .
    And found it , select it and do END TASK .my problem solved.

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

    This will Sound crazy, when ever i build the project the error will be displayed and the avast antivirus will show it as malicious attempt and the project does not run.i just simply disable my antivirus and build my solution again the missing .EXE file has been Created and the project has been successfully executed.

    Or you can try this

    Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

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

    If this error was encountered, you can proceed as the following

    1. End the msbuild.exe task
    2. End the explorer.exe task
    3. Run the explorer.exe task again
    0 讨论(0)
  • 2020-12-02 12:57

    I can confirm this bug exists in VS 2012 Update 2 also.

    My work-around is to:

    1. Clean Solution (and do nothing else)
    2. Close all open documents/files in the solution
    3. Exit VS 2012
    4. Run VS 2012
    5. Build Solution

    I don't know if this is relevant or not, but my project uses "Linked" in class files from other projects - it's a Silverlight 5 project and the only way to share a class that is .NET and SL compatible is to link the files.

    Something to consider ... look for linked files across projects in a single solution.

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

    for me it was the antivirus. Just add visual studio project or entire parent folder to Antivirus exclusion list or you can also add file extension as exclusion and this method worked for me in visual studio 2010/2012

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