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

问题描述 投票:0回答:1

我在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上(在主分支上)添加,提交和推送了文件

我有此警告消息:

##[warning]Directory 'd:\a\1\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中对于人工产物产生了什么问题...

谢谢

azure azure-pipelines azure-pipelines-release-pipeline
1个回答
1
投票

似乎存在放置已发布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'
© www.soinside.com 2019 - 2024. All rights reserved.