gpt4 book ai didi

azure - Azure 管道中未创建任何项目

转载 作者:行者123 更新时间:2023-12-03 00:40:52 25 4
gpt4 key购买 nike

我正在尝试为 .NET Framework 项目创建 Azure 管道。构建似乎已完成,没有错误,但没有生成任何工件:

Azure pipelines

Azure pipelines2

YAML 定义如下,任何人都可以看到我在这里做错了什么吗?

name: 'App-Api-Dev'

trigger:
batch: true
branches:
include: [ development ]
paths:
include:
- src/App.Api/*

pool:
name: 'Default'

variables:
solution: '**/*.sln'
project: '**/Api.csproj'
buildPlatform: 'x86'
buildConfiguration: 'Release'

stages:
- stage: Build
jobs:
- job: Build
pool:
name: Default

steps:
- task: NuGetToolInstaller@1
displayName: 'Install Nuget'

- task: NuGetCommand@2
displayName: 'Nuget Restore'
inputs:
restoreSolution: '$(solution)'

- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(project)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- task: PublishSymbols@2
inputs:
SearchPattern: '**/bin/**/*.pdb'
PublishSymbols: false

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: $(build.artifactStagingDirectory)
ArtifactName: 'PublishBuildArtifact'


最佳答案

根据发布构建工件任务的配置,您将从 $(build.artifactStagingDirectory) 发布工件。但是,该目录在每次新构建之前都会被清除,并且它是空的。

使用此文件夹的典型方法是通过复制文件和发布构建工件任务来发布构建工件。您可以在发布之前将要发布的工件复制到此目录。例如:

- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'

如果您要发布的工件已经在某些目录中准备好了,您也可以直接使用发布构建工件任务。例如:

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.SourcesDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'

另外,建议大家了解一下本地路径以及各个变量的作用。

Build.ArtifactStagingDirectory:代理上的本地路径,任何工件在推送到目的地之前都会复制到该路径。例如:c:\agent_work\1\a

更多详细信息请参见this document .

关于azure - Azure 管道中未创建任何项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64321127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com