简体   繁体   English

Azure DevOps CICD 构建管道因错误而失败:未找到指定的命令或文件

[英]Azure DevOps CICD build pipeline fails with error: specified command or file was not found

I have a CICD build pipeline in Azure Devops for building a .NET Core AWS API Gateway Serverless application.我在 Azure Devops 中有一个 CICD 构建管道,用于构建 .NET Core AWS API Gateway 无服务器应用程序。 The Pipeline is using hosted Windows 2019. The step that fails is:管道使用托管的 Windows 2019。失败的步骤是:

steps:
- task: AmazonWebServices.aws-vsts-tools.LambdaNETCoreDeploy.LambdaNETCoreDeploy@1
  displayName: 'Build solution and generate CloudFormation template. '
  inputs:
    awsCredentials: 'AWS - Development (Infrastructure)'
    regionName: 'ap-southeast-2'
    command: deployServerless
    packageOnly: true
    packageOutputFile: '$(Build.ArtifactStagingDirectory)\serverless-output.yaml'
    lambdaProjectPath: testapi/LCSApi.csproj
    s3Bucket: 'api-dev-xxxxxxxx-s3'
    s3Prefix: 'azure_devops_builds/lcs/'
    additionalArgs: '-template serverless.template '

All I get from the error is the following:我从错误中得到的只是以下内容:

Beginning Serverless Deployment
Performing package-only build of serverless application, output template will be placed in D:\a\1\a\serverless-output.yaml
"C:\Program Files\dotnet\dotnet.exe" lambda package-ci -ot D:\a\1\a\serverless-output.yaml --region ap-southeast-2 --s3-bucket api-dev-xxxxxx-s3 --s3-prefix azure_devops_builds/lcs/ --disable-interactive true -template serverless.template
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-lambda does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
Finishing: Build solution and generate CloudFormation template.

However, if I re-run the pipeline straight after this failure, it works fine.但是,如果我在此失败后立即重新运行管道,则它可以正常工作。 Additionally, it does not always fail with this error.此外,它并不总是因此错误而失败。 Around 70-80% of the time the pipeline works fine.大约 70-80% 的时间管道工作正常。 What could this be and how can i address it?这可能是什么,我该如何解决?

Can you try adding this before your step:你可以尝试在你的步骤之前添加这个:

powershell: |
   dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
   dotnet tool update -g Amazon.Lambda.Tools

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试在 Azure DevOps Pipeline 中构建时未找到项目文件 - Project File Not Found while attempting build in Azure DevOps Pipeline .Net Core解决方案在本地构建,但无法在Azure DevOPS管道上构建 - .Net Core solutions build locally, but fails build on Azure DevOPS pipeline Azure DevOps Pipeline Build 在 GAC 中丢失 DLL 引用失败 - Azure DevOps Pipeline Build fails missing DLL reference in GAC flutter 使用 azure devops 构建管道 - flutter build pipeline with azure devops 如何修复Azure devops上的生成错误“使用文件'--Assembly.snk'中的公钥对输出进行签名错误-找不到文件”? - How to fix the build error ''Error signing output with public key from file '--Assembly.snk' — File not found" on Azure devops? Azure 管道 Maven 构建失败并出现 Spring 类型转换器错误 - Azure Pipeline Maven build fails with Spring type converter error 在 Azure DevOps 中,是否可以使用 API 递归地枚举子管道构建工件? - In Azure DevOps, is it possible to enumerate children pipeline build artifacts recursively with API? 在离线服务器上构建 Azure Devops Pipeline - NuGet 包? - Azure Devops Pipeline build on OFFLINE server - NuGet packages? 是否可以在Azure DevOps上的构建管道中下载文件? - Is it possible to download files during the build pipeline on Azure DevOps? Azure Devops 管道中的警告是否会影响构建时间 - Does Warnings in Azure Devops pipeline affects the build time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM