Command copy exited with code 4 when building - Visual Studio restart solves it

前端 未结 27 2313
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 08:51

Every now and then when I build my solution here (with 7 projects in it) I get the dreaded \'Command copy exited with code 4\' error, in Visual Studio 2010 Premium ed.

27条回答
  •  無奈伤痛
    2020-12-04 09:28

    To expand on rhughes answer,

    The robocopy works beautifully, just incase you need to include sub directories you can use /e to include subs and copy empty directories or /s to include subs excluding empty directories.

    Also robocopy will report back a few things like if new files were copied, this will cause VS to complain since anything above 0 is a failure and robocopy will return 1 if new files have been found. Its worth to mention that robocopy first compares the Source/Dest and only copies the updated/new files.

    To get around this use:

    (robocopy "$(SolutionDir)Solution Items\References\*.dll" "$(TargetDir)") ^& IF %ERRORLEVEL% LEQ 4 exit /B 0
    

提交回复
热议问题