首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure DevOps CICD生成管道失败,错误为:找不到指定的命令或文件

问Azure DevOps CICD生成管道失败,错误为:找不到指定的命令或文件
EN

Stack Overflow用户
提问于 2020-09-01 18:11:14
回答 1查看 344关注 0票数 0

我在Azure Devops中有一个用于构建.NET Core AWS API Gateway无服务器应用程序的CICD构建管道。Pipeline正在使用托管的Windows 2019。失败的步骤是:

代码语言:javascript
复制
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 '

我从这个错误中得到的信息如下:

代码语言:javascript
复制
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.

但是,如果我在失败后直接重新运行管道,它工作得很好。此外,它并不总是失败,并出现此错误。在大约70-80%的时间里,管道运行良好。这可能是什么,我如何解决它?

EN

回答 1

Stack Overflow用户

发布于 2020-09-01 18:50:09

你可以试着在你的步骤之前添加这个:

代码语言:javascript
复制
powershell: |
   dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
   dotnet tool update -g Amazon.Lambda.Tools
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63685654

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档