[英]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()
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.