使用 Azure Devops 将 .NET 核心代码部署到 AWS lambda - 找不到项目路径

Deploying .NET core code to AWS lambda with Azure Devops - project path not found

我正在尝试 运行 AWS Lambda 中的 .Net Core 应用程序,我正在努力从 Azure Pipelines 进行持续部署。

我已经使用 AWS 工具为 Visual Studio 创建了一个空的 .Net Core lambda 项目,并在 azure devops 中使用推荐的“.net 桌面”构建管道设置了一个构建。 yaml代码可以在这里看到:

# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net

trigger:
- master

pool:
  vmImage: 'VS2017-Win2016'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

(我删除了 mstest 任务,因为我的项目不包含任何单元测试)

此管道构建成功。

然后我 运行 一个发布管道,使用来自先前管道的构建并设置为在每个新构建上部署。发布管道包含 "AWS Lambda .NET Core Deployment" 任务,使用我的 AWS lambda 帐户设置。我 select 链接 artifacts/_lambdatest (build) 文件夹(其中 lambdatest 是我的项目的名称)并且在部署时,发布收到错误消息:

2019-01-23T21:33:45.1791634Z ##[error]Unhandled: Not found lambdaProjectPath: D:\a\r1\a\_lambdatest

我该怎么做才能让它发挥作用?我认为问题出在 "Path to lambda project" 指向的位置,但我无法弄清楚该项目还可能在哪里?

根据此构建管道判断,您需要发布构建工件才能访问它们:

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.Repository.LocalPath)/path/to/artifacts'
    artifactName: 'artifact' 
    publishLocation: 'Container'
  condition: always()