此脚本不断为我提供robocopy的错误代码3,但正在按预期工作。我创建了一个日志文件来捕获它,它在命令行和脚本中运行得很好,但我在TFS 2015中的My Build上仍然出现错误。有什么想法吗?
TFS构建错误:
异常消息:TF270015:' RolltoDEV.bat'意外地回来了 退出代码。预期' 0&#39 ;;实际' 3'。
这是我的剧本:
@echo off
set root="D:\Drop\PythonAutomation\1-DEV\PythonAutomation - CD to DEV"
CD /D %root%
FOR /F "delims=" %%i IN ('dir /b /ad-h /t:c /od') DO SET a=%%i
CD /D C:\
robocopy "C:\Builds\1004\PythonAutomation\PythonAutomation - CD to DEV\src\PythonAutomation" "D:\Drop\PythonAutomation\1-DEV\PythonAutomation - CD to DEV\%a%" /E /log:D:\logFileForPython.txt
robocopy "C:\Builds\1004\PythonAutomation\PythonAutomation - CD to DEV\src\PythonAutomation" "D:\PythonAutomation" /E /log+:D:\logFileForPython.txt
这是日志文件:
----------------------------------------------- -------------------------------- ROBOCOPY :: Windows强大的文件复制
开始时间:2017年10月2日星期一上午11:04:27来源: C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ Dest:D:\ Drop \ PythonAutomation \ 1-DEV \ PythonAutomation - CD到DEV \ PythonAutomation - CD到DEV_20171002.23 \
Files : *.* Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
3 C:\Builds\1004\PythonAutomation\PythonAutomation - CD to DEV\src\PythonAutomation\ *EXTRA Dir -1 D:\Drop\PythonAutomation\1-DEV\PythonAutomation - CD to DEV\PythonAutomation - CD to DEV_20171002.23\logs\ New File 1324 PythonAutomation.log 0% 100% New File 1255 PythonAutomation.sln 0% 100% New File 221 PythonAutomation.sln.Any CPU.Debug.vsprops 0% 100% New Dir
1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ 新文件3552 PythonAutomation.pyproj 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD 到DEV \ src \ PythonAutomation \ PythonAutomation \ BaseObjects \ New Dir
1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \配置\ 新文件374 Config-Main.py 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \配置\属性\
新目录0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到 DEV的\ src \ PythonAutomation \ PythonAutomation \配置\属性\ PublishProfiles \ 新目录1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ Configuration \ Properties \ PublishProfiles \ RolltoDEV \ 新文件520 RolltoDEV.bat 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV \ src \ PythonAutomation \ PythonAutomation \ Properties \ New Dir
0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ New Dir 4 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ BaseObjects \ 新文件2664 Email.py 0%100%
新文件573 File.py 0%100%
新文件1260 SSHConnection.py 0%100%
新文件342 init .py 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \属性\ 新目录0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ Properties \ PublishProfiles \ 新目录3 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ Properties \ PublishProfiles \ PublishProfiles \ 新文件864 RolltoDEV.pubxml 0%100%
新文件934 RolltoPROD.pubxml 0%100%
新文件922 RolltoQA.pubxml 0%100%Total Copied Skipped Mismatch FAILED Extras Dirs : 13 12 0 0 0 1 Files : 13 13 0 0 0 0
字节:14.4 k 14.4 k 0 0 0 0
时间:0:00:00 0:00:00 0:00:00 0:00:00
结束日期:2017年10月2日星期一上午11:04:27----------------------------------------------- -------------------------------- ROBOCOPY :: Windows强大的文件复制
开始时间:2017年10月2日星期一上午11:04:27来源: C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ 目的地:D:\ PythonAutomation \
Files : *.* Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
3 C:\Builds\1004\PythonAutomation\PythonAutomation - CD to DEV\src\PythonAutomation\ *EXTRA Dir -1 D:\PythonAutomation\.vs\ *EXTRA Dir -1 D:\PythonAutomation\Outputs\ New File 1324 PythonAutomation.log 0% 100% New File 1255 PythonAutomation.sln 0% 100% New File 221 PythonAutomation.sln.Any CPU.Debug.vsprops 0% 100% New Dir
1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ 新文件3552 PythonAutomation.pyproj 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD 到DEV \ src \ PythonAutomation \ PythonAutomation \ BaseObjects \ New Dir
1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \配置\ 新文件374 Config-Main.py 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \配置\属性\
新目录0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到 DEV的\ src \ PythonAutomation \ PythonAutomation \配置\属性\ PublishProfiles \ 新目录1 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ Configuration \ Properties \ PublishProfiles \ RolltoDEV \ 新文件520 RolltoDEV.bat 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV \ src \ PythonAutomation \ PythonAutomation \ Properties \ New Dir
0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ New Dir 4 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ BaseObjects \ 新文件2664 Email.py 0%100%
新文件573 File.py 0%100%
新文件1260 SSHConnection.py 0%100%
新文件342 init .py 0%100%New Dir 0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD to DEV的\ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \属性\ 新目录0 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ Properties \ PublishProfiles \ 新目录3 C:\ Builds \ 1004 \ PythonAutomation \ PythonAutomation - CD到DEV \ src \ PythonAutomation \ PythonAutomation \ PythonAutomation \ Properties \ PublishProfiles \ PublishProfiles \ 新文件864 RolltoDEV.pubxml 0%100%
新文件934 RolltoPROD.pubxml 0%100%
新文件922 RolltoQA.pubxml 0%100%Total Copied Skipped Mismatch FAILED Extras Dirs : 13 12 0 0 0 2 Files : 13 13 0 0 0 0
字节:14.4 k 14.4 k 0 0 0 0
时间:0:00:00 0:00:00 0:00:00 0:00:00速度:1057500字节/秒。速度:
60.510兆字节/分钟。结束日期:2017年10月2日星期一上午11:04:27
答案 0 :(得分:0)
对于可能遇到此问题的任何人,由于错误在批处理脚本中确实不是错误,它仍然有效,但在TFS中,错误消息是错误消息,因此失败。我为修复此问题所做的是通过在robocopy语句的末尾添加以下代码来绕过我的批处理脚本中的这个特定错误。
2>&1|find /v "TF270015"
希望这可以帮助将来的某个人。感谢@RGuggisburg向我展示了3背后的真实错误消息。