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

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

    I faced same issue. I deleted post-build events and it started working. Some times when we add some SQL components it may add post build commands also.

    0 讨论(0)
  • 2020-12-04 09:20

    What fixed it for me: dig down to the specific solution for the project you want i.e NOT the overall solution file for all the projects.

    Do try - I tried everything else mentioned here but to no avail.

    0 讨论(0)
  • 2020-12-04 09:21

    I faced the same issue in case of XCOPY after build is done. In my case the issue was happening because of READ-ONLY permissions set on folders.

    I added attrib -R command before XCOPY and it solved the issue.

    Hope it helps someone!

    0 讨论(0)
  • 2020-12-04 09:21

    I had the same issue. It was caused by having the same flag twice, for example:

    if $(ConfigurationName) == Release (xcopy "$(TargetDir)." "$(SolutionDir)Deployment\$(ProjectName)\" /e /d /i /y /e)

    Observe that the "/e" flag appears twice. Removing the duplicate solved the issue.

    0 讨论(0)
  • 2020-12-04 09:21

    Can be caused by VMWare Workstation with Shared Folders

    I have the problem always when the destinatinon folder of the xcopy is also mapped as Shared Folder in a VM.

    I solved it with a script running in the vm and deleting the content of the shared folder.

    0 讨论(0)
  • 2020-12-04 09:25

    This can happen in multiple cases:

    1. When the complete string path is longer than 254 chars.
    2. When the name of the file to be copied is wrong.
    3. When the target path is wrong.
    4. When the readonly attribute is set on the copied file or target folder.
    0 讨论(0)
提交回复
热议问题