【问题标题】:Azure DevOps Build Pipeline: 'publish' command is executing 'dotnet build' instead of 'dotnet publish'Azure DevOps 构建管道:“发布”命令正在执行“dotnet build”而不是“dotnet publish”
【发布时间】:2021-02-10 05:49:52
【问题描述】:

我有一个 azure 构建管道,我正在尝试修改它以添加构建和发布以及一个 azure 函数。

我正在尝试使用 dotnet cli 运行“发布”命令,但无论出于何种原因,azure devops 正在运行“构建”命令。

我的管道如下所示:

trigger:
  - master

variables:
  solution: "**/*.sln"

jobs:
  - job: backend_build
      - task: DotNetCoreCLI@2
        inputs:
          commands: "publish"
          publishWebProjects: false
          projects: "someFunction.csproj"
          arguments: "--configuration Release -r win10-x64"
        displayName: "Publish someFunction"
      - task: PublishPipelineArtifact@1
        inputs:
          path: "$(System.DefaultWorkingDirectory)/someFunction/bin/Release/netcoreapp3.1/win10-x64/publish.zip"
          artifact: "ApplyMigrations"
        displayName: "Publish someFunction Function"

但是当这个管道执行时,Publish someFunction 任务最终会执行dotnet build 而不是dotnet publish

47ad-91fc-a4b1d163081b/2.175.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"
2020-10-27T20:36:40.0448279Z ##[debug]/usr/bin/dotnet arg: --configuration Release -r win10-x64
2020-10-27T20:36:40.0454259Z ##[debug]exec tool: /usr/bin/dotnet
2020-10-27T20:36:40.0454556Z ##[debug]arguments:
2020-10-27T20:36:40.0454825Z ##[debug]   build
2020-10-27T20:36:40.0455170Z ##[debug]   /home/vsts/work/1/s/someFunction.csproj
2020-10-27T20:36:40.0456258Z ##[debug]   -dl:CentralLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.175.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.175.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"
2020-10-27T20:36:40.0457276Z ##[debug]   --configuration
2020-10-27T20:36:40.0457663Z ##[debug]   Release
2020-10-27T20:36:40.0463060Z ##[debug]   -r
2020-10-27T20:36:40.0463499Z ##[debug]   win10-x64
2020-10-27T20:36:40.0465119Z [command]/usr/bin/dotnet build /home/vsts/work/1/s/someFunction.csproj -dl:CentralLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.175.0/dotnet-build-helpers

有人知道为什么会发生这种情况吗?没有显示错误,只是没有执行正确的命令...

【问题讨论】:

    标签: c# .net azure .net-core azure-devops


    【解决方案1】:

    您的错误是commands: "publish"。应该是command,而不是commands

    因为您没有包含command 值,所以它使用默认值 Build。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-10
      • 1970-01-01
      相关资源
      最近更新 更多