![](/img/trans.png)
[英]Azure Pipeline fails on `dotnet build` with error "command or file was not found"
[英]Azure Pipeline dotnet not creating release build
我正在尝试从我在发布版本中基于 Azure 管道构建的项目中创建一个工件,但是当我查看构建的结果时,它处于调试模式,我不确定我做错了什么。
我通过一个变量传递构建配置,但我通过步骤的名称检查了它,它看起来是正确的,我已经阅读了文档以仔细检查我做错了什么,但对我来说似乎没有任何问题
# .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
trigger:
- azure-pipelines-self-hosted
pool:
vmImage: 'ubuntu-latest'
variables:
solution: 'Something.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
inputs:
version: '5.0.x'
packageType: 'sdk'
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: $(solution)
feedsToUse: select
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
includeNuGetOrg: true
projects: $(solution)
configuration: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'dotnet test $(buildConfiguration)'
inputs:
command: 'test'
projects: $(solution)
configuration: '--configuration $(buildConfiguration)'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**/*
!.git/**/*
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
需要更多信息,但如果您在 Something.sln 中有多个项目,请双击您的项目或所有项目并检查 .csproj 文件配置,该应用程序是否处于调试模式。
在inputs
部分,将configuration
项名称更改为arguments
例如
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
includeNuGetOrg: true
projects: $(solution)
arguments: '--configuration $(buildConfiguration)'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.