有没有办法轻松获取工件文件名?看起来TFS已经知道这一点,如下面的日志所示:
No path specified for search pattern: *.zip defaulting to: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Searching for: *.zip under directory: F:\TFS2017_Release_Agent\_work\r1\a
2017-12-08T16:38:36.8519067Z Found: 1 files to extract:
2017-12-08T16:38:36.8519067Z F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z Creating destination folder: F:\TFS2017_Release_Agent\_work\r1\a\48
2017-12-08T16:38:36.8519067Z Extracting file: F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8519067Z [command]F:\TFS2017_Release_Agent\_work\_tasks\ExtractFiles_5e1e3830-fbfb-11e5-aab1-090c92bc4988\1.112.1\7zip\7z.exe x -oF:\TFS2017_Release_Agent\_work\r1\a\48 F:\TFS2017_Release_Agent\_work\r1\a\ZFJ0_ServiceSearchPlusBuildDefn\BETALink.Service.SearchPlus\ZFJ0_BETALink10.4 DevOps_BETALink.Service.SearchPlus_1.0.0_886.zip
2017-12-08T16:38:36.8987827Z
答案 0 :(得分:1)
对于其他人,我必须写几行来获取zip文件名。 ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName是我的{Artifact alias}:
$zipdir = "$(System.DefaultWorkingDirectory)\$(Release.Artifacts.ZFJ0_ServiceSearchPlusBuildDefn.DefinitionName)\$(Release.DefinitionName)"
Write-Host "zipfile directory: "$zipdir
$zipfile = Get-ChildItem -Filter *.zip "$zipdir"
Write-Host "zipfile : "$zipfile
答案 1 :(得分:0)
工件不是“文件”。在你的具体情况下,它是。但通常,工件可以包含任意数量的文件。
无法检索工件中存在的文件,因为工件也可以是指向UNC共享的指针。