所以我有一个成功构建的 CCNET 项目,直到我包含一个 RoboCopy exec 任务来进行部署:

<exec>
  <executable>C:\Windows\System32\robocopy.exe</executable>
  <buildArgs>D:\CCNETProjects\$(projectname)\Builds\Latest_Build\_PublishedWebsites\$(projectname) D:\TEST_$(projectname) *.* /E /NP /XF *.config /XD config</buildArgs>
  <buildTimeoutSeconds>60</buildTimeoutSeconds>
  <successExitCodes>0,1,2,4,8,16</successExitCodes>
</exec>

如您所见,我已经包含了此处列出的所有可能的退出代码; http://ss64.com/nt/robocopy-exit.html

任务成功执行(文件复制成功),构建结果显示此任务没有错误,但我的构建仍然失败!
<buildresults>
  <message>-------------------------------------------------------------------------------</message>
  <message>   ROBOCOPY     ::     Robust File Copy for Windows                              </message>
  <message>-------------------------------------------------------------------------------</message>
  <message>  Started : Wed Jun 27 19:50:45 2012</message>
  <message>   Source : D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\</message>
  <message>     Dest : D:\TEST_FieldworkReportGenerator\</message>
  <message>    Files : *.*</message>
  <message>     </message>
  <message>Exc Files : *.config</message>
  <message>     </message>
  <message> Exc Dirs : config</message>
  <message>     </message>
  <message>  Options : *.* /S /E /COPY:DAT /NP /R:1000000 /W:30 </message>
  <message>------------------------------------------------------------------------------</message>
  <message>                    5    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\</message>
  <message> *EXTRA Dir        -1    D:\TEST_FieldworkReportGenerator\App_Data\</message>
  <message> *EXTRA Dir        -1    D:\TEST_FieldworkReportGenerator\downloads\</message>
  <message> *EXTRA Dir        -1    D:\TEST_FieldworkReportGenerator\uploads\</message>
  <message>                   18    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\bin\</message>
  <message>     Newer              22528    ExcelHelpers.dll</message>
  <message>     Newer              48640    ExcelHelpers.pdb</message>
  <message>     Newer              33280    FieldworkReportGenerator.dll</message>
  <message>     Newer              54784    FieldworkReportGenerator.pdb</message>
  <message>                    1    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Content\</message>
  <message>                    0    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Content\themes\</message>
  <message>                   14    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Content\themes\base\</message>
  <message>                   13    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Content\themes\base\images\</message>
  <message>                   20    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Scripts\</message>
  <message>                    6    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\uploadify\</message>
  <message>                    2    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Views\</message>
  <message>                    4    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Views\Account\</message>
  <message>                    3    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Views\Home\</message>
  <message>                    3    D:\CCNETProjects\FieldworkReportGenerator\Builds\Latest_Build\_PublishedWebsites\FieldworkReportGenerator\Views\Shared\</message>
  <message>------------------------------------------------------------------------------</message>
  <message>               Total    Copied   Skipped  Mismatch    FAILED    Extras</message>
  <message>    Dirs :        13         0        13         0         0         3</message>
  <message>   Files :        89         4        85         0         0         0</message>
  <message>   Bytes :    9.61 m   155.5 k    9.46 m         0         0         0</message>
  <message>   Times :   0:00:00   0:00:00                       0:00:00   0:00:00</message>
  <message>   Speed :              462883 Bytes/sec.</message>
  <message>   Speed :              26.486 MegaBytes/min.</message>
  <message>   Ended : Wed Jun 27 19:50:45 2012</message>
</buildresults>

ccnet.log 信息也不显示任何内容;
2012-06-27 19:44:02,507 [4:DEBUG] [FieldworkReportGenerator C:\Windows\System32\robocopy.exe]    Ended : Wed Jun 27 19:44:02 2012
2012-06-27 19:44:02,538 [4:DEBUG] [FieldworkReportGenerator C:\Windows\System32\robocopy.exe] standard-output stream closed -- null received in event
2012-06-27 19:44:02,538 [11:DEBUG] [FieldworkReportGenerator C:\Windows\System32\robocopy.exe] standard-error stream closed -- null received in event
2012-06-27 19:44:02,538 [5:DEBUG] [FieldworkReportGenerator C:\Windows\System32\robocopy.exe] process exited event received
2012-06-27 19:44:02,632 [FieldworkReportGenerator:INFO] Delete merged file 'D:\CCNETProjects\FieldworkReportGenerator\Artifacts\msbuild-results-7d2f394c-2b07-4131-9cfc-4d3f05968758.xml'.
2012-06-27 19:44:02,632 [FieldworkReportGenerator:INFO] Integration complete: Failure - 27/06/2012 19:44:02

我都没有想法了。

最佳答案

退出代码是位掩码。如果将 1(复制某些文件)和 2(检测到额外目录)的代码组合在一起,您可以获得 3 的退出代码。从您的输出看来就是这种情况。

关于cruisecontrol.net - 使用 RoboCopy 的 CCNET Exec 即使使用 <successExitCodes> 也会失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11233236/

10-12 19:08