powershell - Azure DevOps 托管代理管道 "Unable to locate executable file: ' Powershell'

标签 powershell deployment azure-devops

Azure DevOps 部署代理(自托管在我们的一个 Windows VM 上)决定突然停止工作,在执行 IIS Web App Deploy 时抛出此错误。步:Error: Unable to locate executable file: 'powershell'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable.最近有没有其他人得到这个?
查看日志,有一个警告表明:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance.此错误有些不对劲,因为 A) 我使用 Powershell 安装了代理,B) 我删除了该代理,并且在发生此错误后能够使用 PowerShell 重新安装它。
管道步骤本身与默认值没有变化,并且已经运行多年没有问题——这是从 DevOps 生成的 YAML 来证明这一点(如果间距被 SO 弄乱了,请道歉):

steps:
- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'IIS Web App Deploy'
  inputs:
       WebSiteName: '$(Parameters.WebsiteName)'
       TakeAppOfflineFlag: True
       XmlVariableSubstitution: True

最佳答案

新版本打破了这一任务。
https://github.com/microsoft/azure-pipelines-tasks/issues/14595
添加 ADO_FORCE_USE_7ZIP=true 作为管道变量。

关于powershell - Azure DevOps 托管代理管道 "Unable to locate executable file: ' Powershell',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66675972/

相关文章:

powershell - 使用 invoke-restmethod 时设置主机头

powershell - Powershell追加到输出

ruby-on-rails - 如何在 Capistrano 部署期间上传文件到发布目录?

node.js - travis 上的两个独立部署配置

azure-devops - 处理多个项目和单个团队

powershell - 如何创建PowerShell的 “main”函数?

powershell - 从终端进行Visual Studio Code PowerShell代码调试

sql-server - 命令在控制台中运行良好,但在 Powershell 使用时运行不佳

MSBuild参数生成文件

c# - 以编程方式访问存储帐户