简体   繁体   English

Azure 管道完成后看不到我的构建工件

[英]Can't see my build artifacts after Azure Pipeline finished

I have a very simple pipeline yaml (see below)我有一个非常简单的管道 yaml(见下文)

What I am wanting is to build the projects in my solution, and retain the artifacts that get created so that I can release them to Azure in a separate release pipeline.我想要的是在我的解决方案中构建项目,并保留创建的工件,以便我可以在单独的发布管道中将它们发布到 Azure。

I recall doing something like this before, and when it worked I could see an option to view the build artifacts next to the successful build list item.我记得以前做过类似的事情,当它起作用时,我可以在成功的构建列表项旁边看到一个查看构建工件的选项。 However I see no such thing anymore.但是我再也看不到这样的事情了。

What am I missing here?我在这里想念什么?

Pipeline:管道:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

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

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: '**/*.csproj'
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    zipAfterPublish: true

You may add something like that (copy to artifact folder and publish):您可以添加类似的内容(复制到工件文件夹并发布):

- task: CopyFiles@2
       displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
       inputs:
       SourceFolder: '$(system.defaultworkingdirectory)'
       Contents: '**\bin\$(BuildConfiguration)\**'
       TargetFolder: '$(build.artifactstagingdirectory)'
       condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
       displayName: 'Publish Artifact: drop'
       inputs:
       PathtoPublish: '$(build.artifactstagingdirectory)'
       condition: succeededOrFailed()

You have to publish your Build Artifact, use this task:你必须发布你的构建工件,使用这个任务:

发布工件

After that you can check your Artifacts under Summary:之后,您可以在摘要下检查您的工件:

人工制品

Try to add CopyFiles task and PublishBuildArtifacts task:尝试添加 CopyFiles 任务和 PublishBuildArtifacts 任务:

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

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    projects: '**/*.csproj'
    feedsToUse: 'config'
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    zipAfterPublish: true

- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
  inputs:
    SourceFolder: '$(agent.builddirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'

在此处输入图像描述

I based my answer by ms documentation ( all details are available https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops ).我的回答基于 ms 文档(所有详细信息都可用https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops )。

There are three tasks based on DotNetCoreCLI (restore, build and publish to correct dir) and last task that publish artifact to the feed.基于 DotNetCoreCLI 的三个任务(恢复、构建和发布到正确的目录)和最后一个任务将工件发布到提要。

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

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

steps:

- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '**/*.csproj'

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    command: build
    projects: '**/*.csproj'
    arguments: '--configuration $(buildConfiguration)' # Update this to match your need

- task: DotNetCoreCLI@2
  displayName: Package
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

# this code takes all the files in $(Build.ArtifactStagingDirectory) and uploads them as an artifact of your build.

- task: PublishBuildArtifacts@1
  displayName: "Publish as artifact"
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)' 
    artifactName: 'myWebsiteName'

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

相关问题 Azure Build Pipeline 无法发布工件 - Azure Build Pipeline can't publish artifacts 请参阅使用 YAML 管道在 Azure DevOps 中构建工件 - See Build Artifacts in Azure DevOps with YAML Pipeline Azure CD 管道找不到构建工件 - Azure CD pipeline can't find build artifacts 如何在 Azure DevOps 管道中管理构建工件? - How build artifacts are managed in Azure DevOps pipeline? MSFT Azure 管道可以作为源代码控制系统连接到 Bitbucket,然后构建构建工件并将其部署到本地服务器吗? - Can MSFT Azure pipeline connect to Bitbucket as source control system then build and deploy the build artifacts to on-premise server? 在Azure VM上看不到我的服务器 - Can't see my server on an azure vm Azure 发布管道将多个构建工件下载为单个 zip - Azure Release pipeline download multiple build artifacts as single zip 如何删除我的构建管道发布的工件? - How do I delete the artifacts published by my build pipeline? 我们可以在发布管道中发布工件 - Azure devOps 吗? - Can we publish artifacts in release pipeline - Azure devOps? 如何将项目集合构建服务身份设置为我的 Azure 工件提要的贡献者 - How can set Project Collection Build Service identity to be a Contributor on my Azure artifacts feed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM