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.
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.
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.
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!
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.
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.
This can happen in multiple cases: