构建管道文件夹系统如何工作?
How is working the build pipeline folder system?
我想了解构建系统在 Azure DevOps 中的工作原理:
先展示一下我的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
name: $(Date:yy).$(Date:MM).$(Rev:r)
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: NyGetCommand Restore
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
现在上一个任务的错误:
##[warning]Directory 'D:\a\a' is empty. Nothing will be added to build artifact 'drop'.
查看我的日志后,我意识到构建 (VSBuild@1) 与发布 (VSBuild@1) 不在同一文件夹中播放。
Build is happening in D:\a\s
Publish is looking in D:\a\a
为什么会这样?我在哪里可以控制这个。什么是官方文件夹。我在哪里可以找到有关这些代理和文件夹的 depp 文档?
在下面的步骤中,您将指定要发布的文件夹。具体来说,您正在尝试发布 $(Build.ArtifactStagingDirectory)
.
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
但是当你还没有上演神器时,那里不会有任何信息。
下面是 $(Build.ArtifactStagingDirectory)
变量的描述:
The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\a
A typical way to use this folder is to publish your build artifacts with the Copy files and Publish build artifacts tasks.
Note: Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable. This directory is purged before each new build, so you don't have to clean it up yourself.
See Artifacts in Azure Pipelines.
This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag.
您很可能错过了此 Example: Copy and publish binaries 中的第一个任务之类的东西。
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
我想了解构建系统在 Azure DevOps 中的工作原理:
先展示一下我的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
name: $(Date:yy).$(Date:MM).$(Rev:r)
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: NyGetCommand Restore
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
现在上一个任务的错误:
##[warning]Directory 'D:\a\a' is empty. Nothing will be added to build artifact 'drop'.
查看我的日志后,我意识到构建 (VSBuild@1) 与发布 (VSBuild@1) 不在同一文件夹中播放。
Build is happening in D:\a\s
Publish is looking in D:\a\a
为什么会这样?我在哪里可以控制这个。什么是官方文件夹。我在哪里可以找到有关这些代理和文件夹的 depp 文档?
在下面的步骤中,您将指定要发布的文件夹。具体来说,您正在尝试发布 $(Build.ArtifactStagingDirectory)
.
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
但是当你还没有上演神器时,那里不会有任何信息。
下面是 $(Build.ArtifactStagingDirectory)
变量的描述:
The local path on the agent where any artifacts are copied to before being pushed to their destination. For example:
c:\agent_work\a
A typical way to use this folder is to publish your build artifacts with the Copy files and Publish build artifacts tasks.
Note: Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable. This directory is purged before each new build, so you don't have to clean it up yourself.
See Artifacts in Azure Pipelines.
This variable is agent-scoped, and can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag.
您很可能错过了此 Example: Copy and publish binaries 中的第一个任务之类的东西。
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop