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

前端 未结 27 2369
被撕碎了的回忆
被撕碎了的回忆 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:08

    I've invariably found this to be a file locking issue. Code 4 is Cannot Access File. One partial solution I found is to use the /C option for xcopy (which continues on error). Not really a solution but mostly it has stopped my builds from failing.

    Another solution which only works on 32 bit is to use the unlocker tool to release the windows handles on the file before the copy.

    Edit: I've just realised that it works under 64 bits too.

提交回复
热议问题