【发布时间】:2019-09-11 18:47:14
【问题描述】:
我非常需要帮助来创建我的 yml 构建文件,因为我在任何地方都找不到任何好的教程、示例或其他帮助之王。我总是收到类似的错误:看到警告,看来我的构建工件总是空的。所有步骤都成功,但我无法部署,因为找不到我的文件。笨蛋。
##[section]Starting: PublishBuildArtifacts
==============================================================================
Task : Publish Build Artifacts
Description : Publish build artifacts to Azure Pipelines/TFS or a file share
Version : 1.142.2
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=708390)
==============================================================================
##[warning]Directory '/home/vsts/work/1/a' is empty. Nothing will be added to build artifact 'drop'.
##[section]Finishing: PublishBuildArtifacts
这是我的管道定义
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
variables:
buildConfiguration: 'Release'
steps:
# - script: dotnet build --configuration $(buildConfiguration)
# displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreInstaller@0
inputs:
version: '2.2.202' # replace this value with the version that you need for your project
- script: dotnet restore
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration Release' # Update this to match your need
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: 'drop'
注意我评论的 2 行
# - script: dotnet build --configuration $(buildConfiguration)
# displayName: 'dotnet build $(buildConfiguration)'
实际上是默认脚本的一部分。我没有使用默认脚本。我正在关注教程https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops
还有为什么我不能使用其他项目可用的模板。是因为我使用的是 DevOps 存储库还是因为我的项目有特定的设置?我还有其他项目,我可以使用图形模板和任务管理构建然后部署。容易多了。
【问题讨论】:
-
您只是在构建项目,但您还需要发布它才能显示工件。为此使用
dotnet publish。
标签: asp.net-core azure-devops azure-pipelines asp.net-core-2.2