【发布时间】:2018-12-05 12:21:58
【问题描述】:
我面临 Compress-Archive cmd 行的问题。我需要压缩放置文件(一些文件)并将压缩的 .rar 推送到 Azure blob 存储。
在 VSTS 中,我们有默认的压缩任务 & 这对我有用,但在 TFS 2015 中,我使用的是 powershell cmd
Compress-Archive -Path $(Build.ArtifactStagingDirectory)\* -DestinationPath $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
我结束了。有错误
2018-06-26T17:29:08.5918176Z 生成脚本。
2018-06-26T17:29:08.5918734Z 格式化命令:. 'D:\a\1\s\arch.ps1'
2018-06-26T17:29:09.3003116Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command".'D:\ a_temp\e2b5fc08-c599-49ec-bbd6-8a4a69f8d977.ps1'"
2018-06-26T17:29:14.3345598Z Build.ArtifactStagingDirectory:术语“Build.ArtifactStagingDirectory”未被识别为 cmdlet 的名称,
2018-06-26T17:29:14.3345966Z 函数、脚本文件或可运行的程序。检查名称的拼写,或者如果包含路径,请验证
2018-06-26T17:29:14.3346099Z 路径正确,然后重试。
2018-06-26T17:29:14.3346952Z 在 D:\a\1\s\arch.ps1:5 字符:47
2018-06-26T17:29:14.3347355Z + ... e -Path .* -DestinationPath $(Build.ArtifactStagingDirectory)/$(Buil ...
2018-06-26T17:29:14.3348520Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-06-26T17:29:14.3348782Z + CategoryInfo : ObjectNotFound: (Build.ArtifactStagingDirectory:String) [], ParentContainsErrorRecordExc
2018-06-26T17:29:14.3348968Z 版本
2018-06-26T17:29:14.3349135Z + FullyQualifiedErrorId:CommandNotFoundException
2018-06-26T17:29:14.3349466Z
2018-06-26T17:29:14.5676478Z ##[错误]PowerShell 以代码“1”退出。
如何在我的 powershell 脚本中访问构建变量?有人可以指导我吗?
【问题讨论】:
标签: powershell tfs azure-devops