我看过this page并编写了以下测试powershell脚本
$guid = $env:taskGuid
write-host "##vso[task.logdetail id=$guid;name=project1;type=build;order=1]create new timeline record"
# write-host "##vso[task.logdetail id=new guid;parentid=exist timeline record guid;name=project1;type=build;order=1]create new nested timeline record"
write-host "##vso[task.logdetail id=$guid;progress=50;state=InProgress;]update timeline record"
write-host "##vso[task.logdetail id=$guid;state=Completed;result=Succeeded]complete timeline record"
我希望在日志中看到其他条目,但是我什么也没看到,甚至没有出现write-host
语句。
所以我有2个问题
答案 0 :(得分:2)
您正在使用的语法旨在显示在时间轴上,而该时间轴似乎尚未在新的构建布局中使用(请参见here以禁用新的构建输出的预览)。如果使用旧的构建输出,请为您正在执行的Powershell脚本选择步骤,然后选择时间线,然后您将看到记录器正在记录您的步骤(在我的情况下为ssloan)。 。请参阅here,以更好地掌握各种构建步骤,以尽我所能。
对于仅输出日志,您可以使用PowerShell utilities中提供的各种写入器,只要您始终有要写入的主机,“写入主机”就足够了。这些将出现在您的日志中