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

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

    If you are here because your project fails to build on a build server, but builds fine "manually" on a dev machine, and you are doing xcopy only for debugging and to emulate a production environment on a dev machine, then you may want to look at this solution:

    https://stackoverflow.com/a/1732478/2279059

    You simply turn off post build events on the build server using

    msbuild foo.sln /p:PostBuildEvent=
    

    This is not good enough if you have other post build events that also need to run on the build server, and it is not a general solution. However, since there are so many different causes of this problem, there cannot be a general solution. One of the many answers to this question (and its duplicates) will probably help, but be careful with approaches that only somehow circumvent error handling (such as xcopy /C). Those may work for you, particularly also in the build server scenario, but I think this one is more reliable, IF it can be used.

    It has also been suggested that with newer versions of Visual Studio, the problem no longer exists, so if you are using an old version, consider updating your build tools.

提交回复
热议问题