0
votes

I have an azure build pipeline that I'm trying to modify to add build and publish and an azure function.

I'm trying to run a 'publish' command using the dotnet cli, but for whatever reason, azure devops is running a 'build' command instead.

My pipeline looks like this:

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"

But when this pipeline executes, that Publish someFunction task ends up executing dotnet build instead of 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

Anyone have any ideas why this might be happening? There are no errors being displayed, it just isn't executing the right command...

1

1 Answers

0
votes

Your error is commands: "publish". It should be command, not commands.

Because you have not included a command value, it uses the default value of Build.