John
John

Reputation: 7049

Azure Devops Pipelines dotnet publish task ignores projects setting

I have a repo with a couple of dotnet projects, two of them web projects, and I need to specify which to publish.

My yaml file is:

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    projects: '**/Squil.Web.csproj'
    arguments: '-o $(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1    
  displayName: 'Publish Artifact: web'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

Something similar worked as long as I had only one web project, but after factoring out most Blazor related stuff into another project Squil.Razor, it no longer does: The publish task always picks that one, which is a Razor Class Library.

I also tried to use 'Squil.Web' as the projects parameter, but no matter what I put there, it gets ignored.

I've been pulling my hair out over this for hours now. I found a related question from which I got the syntax '**/Squil.Web.csproj', but that didn't work for me either.

I know I can use the dotnet command line instead, but I'd rather use the task.

This is .NET 6.

What else to try?

Upvotes: 2

Views: 1139

Answers (1)

John
John

Reputation: 7049

I found what's wrong.

Unless publishWebProjects: false is explicitly specified projects is ignored.

Not the best defaults in my book.

Upvotes: 8

Related Questions