Post-Build Event VS 2010 "Fails", but not really

I have a relatively simple post-build event happening in VS 2010, just two copy operations.

The result of the copy operations shows that they succeeded, and I checked the directories and the copy of the file works fine.

VS tells me the build failed, but doesn't tell me why ... Here is the exact result:

1>PostBuildEvent: 1> Description: Copying Library to Animation-Calibrator 1> 1 file(s) copied. 1> 1> ------------------------------------------------------------------------------- 1> ROBOCOPY :: Robust File Copy for Windows 1> ------------------------------------------------------------------------------- 1> 1> Started : Thu Jul 05 14:26:34 2012 1> 1> Source : C:\Users\Tag\Google Drive\Projects\TGAEngine\VS2010\obj\ 1> Dest : C:\Users\Tag\Google Drive\Projects\Animation-Calibrator\lib\TGAEngine\obj\ 1> 1> Files : *.* 1> 1> Options : *.* /S /COPY:DAT /R:1000000 /W:30 1> 1> ------------------------------------------------------------------------------ ... List of files copied, no errors 1> 1> ------------------------------------------------------------------------------ 1> 1> Total Copied Skipped Mismatch FAILED Extras 1> Dirs : 2 0 2 0 0 0 1> Files : 29 29 0 0 0 1 1> Bytes : 1.92 m 1.92 m 0 0 0 697 1> Times : 0:00:00 0:00:00 0:00:00 0:00:00 1> 1> 1> Speed : 100824150 Bytes/sec. 1> Speed : 5769.204 MegaBytes/min. 1> 1> Ended : Thu Jul 05 14:26:34 2012 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "copy /y .\TGAEngine.lib .\..\..\Animation-Calibrator\lib\TGAEngine 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: robocopy /s ".\obj" ".\..\..\Animation-Calibrator\lib\TGAEngine\obj" 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 3. 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:00.11 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

I narrowed it down to the robocopy team.
If I run robocopy /s source dest VS, then crash.
If I do not use the '/ s' option, it does not interrupt, but the files are not copied.

Any thoughts?

I just do not send the script because I ran it manually and there were no errors.

+8
visual-studio-2010 post-build-event
source share
2 answers

Typically, a process returns with an exit status of 0 if it succeeded, and nonzero if it succeeded. robocopy seems to have a non-standard exit code definition : 1 means success; 0 means the files were not copied. You see why VS is not complaining if you omit /s ?

It seems that your process has exited with status 3. Please contact robocopy docs if this meets your requirements. To my understanding, any value of 2 or more means a problem.

You should check the exit code yourself if it indicates an error condition, and exit from 0 if everything is ok (the code below is not tested):

 if ERRORLEVEL 2 goto HandleError exit 0 :HandleError exit %ERRORLEVEL% 
+10
source share

I found this one here

 (robocopy /s source dest) ^& IF %ERRORLEVEL% LEQ 3 exit 0 

This is a shorter version of the krlmlr response that can be run on a single command line. I consider the error level 3 or lower to be successful, since it is an exit code when it copies files (exit code 1), and there are additional files at the destination (exit code 2).

0
source share

All Articles