azure devops 构建并部署到应用服务

azure devops build and deploy to app service

我已经在 dev.azure.com

上创建了一个空项目

我已经在本地计算机上克隆了存储库。

我在主文件夹中有 运行 这个命令:

$ dotnet new mvc

我已经创建了这个 azure-pipelines.yml 文件:

trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    feedsToUse: 'select'
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'artifact2'

我在 dev.azure.com(在 master 分支上)

上添加、提交和推送了文件

我收到这条警告消息:

##[warning]Directory 'd:\a\a' is empty. Nothing will be added to build artifact 'artifact2'.

我已经创建了一个发布管道,但我收到一个错误:

##[error]Error: No package found with specified pattern: D:\a\r1\a\**\*.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

我不明白我的 azure-pipelines.yml 神器制作有什么问题...

谢谢

发布的dll 放置位置似乎有问题。试试下面的 yaml,我已经为发布的 dll 明确设置了输出目录,并在发布后压缩了文件(这可能是你的下一个问题)。我还明确设置了在哪个文件夹中查找已发布的文件夹以发布工件。

trigger:
    - master

    pool:
      vmImage: 'windows-latest'

    steps:
    - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        feedsToUse: 'select'
    - task: DotNetCoreCLI@2
      inputs:
        command: 'build'
    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: true
        modifyOutputPath: true
        arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'
        zipAfterPublish: true
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'artifact2'