NoName
NoName

Reputation: 8025

Visual Studio Post-Build xcopy dont work: error MSB3073: :"VCEnd" exited with code 4

I have following post build command:

XCOPY "$(SolutionDir)*" "D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D

When building I get these message:

1>------ Build started: Project: Win1, Configuration: Debug Win32 ------
1>  Can't read file: "E:\exclude.txt"
1>  
1>  0 File(s) copied
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5):
    error MSB3073: The command "XCOPY "C:\Users\Administrator\Desktop\Win1\*" 
    "D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5):
     error MSB3073: :VCEnd" exited with code 4.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

E:\exclude.txt file content:

.sdf

\Debug\

\ipch\

\Trash\

I don't know why I get this error. VS say Can't read file: "E:\exclude.txt" but I check that file exist. I also read other posts on SO but don't see any have same problem. Do you know how to fix it?

EDIT:

xcopy was successfully copy files, thank to @RustyX's answer. But it still gave error code 1:

1>------ Build started: Project: Win1, Configuration: Debug Win32 ------
1>  tkk.cpp
1>  Win1.vcxproj -> D:\T\Win1\Win1.exe
1>  C:\Users\Administrator\Desktop\Win1\Source\tkk.h
1>  1 File(s) copied
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(112,5):
    error MSB3073: The command "XCOPY "C:\Users\Administrator\Desktop\Win1\*"
    "D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(112,5): 
    error MSB3073: echo f | XCOPY "C:\Users\Administrator\Desktop\Win1\Debug\Win1.pch" 
    "D:\VS\Win1\Debug\Win1.pch" /Y /E /F /D" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

When I run this command in cmd window, it says 0 file copied:

XCOPY "C:\Users\Administrator\Desktop\Win1\*"
    "D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D

and:

echo f | XCOPY "C:\Users\Administrator\Desktop\Win1\Debug\Win1.pch" 
    "D:\VS\Win1\Debug\Win1.pch" /Y /E /F /D

What is the error?

Upvotes: 3

Views: 6966

Answers (1)

rustyx
rustyx

Reputation: 85481

You XCOPY command is invalid. If you run it in a command prompt, you'll see that it doesn't work:

> XCOPY "C:\Users\Administrator\Desktop\Win1\*" "D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D
Can't read file: "E:\exclude.txt"

Try removing the quotes after /EXCLUDE:

XCOPY "$(SolutionDir)*" "D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D

Upvotes: 1

Related Questions