[Get-Content],ItemNotFoundException:VSTS PowerShell 任务中的 PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
[Get-Content], ItemNotFoundException : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand in VSTS PowerShell task
正在使用 powershell 命令行进行 ARM 模板部署
$manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
将找到并 运行 .json 文件。在我的 本地 PC 上 运行 没问题。但是,当 运行 通过 VSTS PowerShell 任务 使用同一行时,我会收到以下问题:
At C:\XX_work\r7\a\CIBuild\drop\XX\XX\Deployment\Manif
estAzureDeployment.ps1:191 char:21
+ $manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\XX...a\manifest.json:String) [Get-Content], ItemNotFoundEx
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
所以,请给我适合这个问题的建议
使用通过 built-in release variable 的绝对路径。
例如,System.DefaultWorkingDirectory
($(System.DefaultWorkingDirectory)
):在发布部署期间将工件下载到的目录。如果需要将工件下载到代理程序,则在每次部署之前清除该目录。与 Agent.ReleaseDirectory
和 System.ArtifactsDirectory
.
相同
正在使用 powershell 命令行进行 ARM 模板部署
$manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
将找到并 运行 .json 文件。在我的 本地 PC 上 运行 没问题。但是,当 运行 通过 VSTS PowerShell 任务 使用同一行时,我会收到以下问题:
At C:\XX_work\r7\a\CIBuild\drop\XX\XX\Deployment\Manif estAzureDeployment.ps1:191 char:21 + $manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\XX...a\manifest.json:String) [Get-Content], ItemNotFoundEx
ception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
所以,请给我适合这个问题的建议
使用通过 built-in release variable 的绝对路径。
例如,System.DefaultWorkingDirectory
($(System.DefaultWorkingDirectory)
):在发布部署期间将工件下载到的目录。如果需要将工件下载到代理程序,则在每次部署之前清除该目录。与 Agent.ReleaseDirectory
和 System.ArtifactsDirectory
.