Xcopy exit code 4 means “Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.“
It looks like Visual Studio is supplying invalid arguments to xcopy. Check your post-build event command via Project > Right Click > Properties > Build Events > Post Build Event
.
Note that if the $(ProjectDir)
or similar macro terms have spaces in the resulting paths when expanded, then they will need to be wrapped in double quotes. For example:
xcopy "$(ProjectDir)Library\dsoframer.ocx" "$(TargetDir)" /Y /E /D1