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

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

提交回复
热议问题