Home:ALL Converter>Azure Devops Pipelines dotnet publish task ignores projects setting

Azure Devops Pipelines dotnet publish task ignores projects setting

Ask Time:2022-10-09T05:21:23         Author:John

Json Formatter

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?

Author:John,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74000608/azure-devops-pipelines-dotnet-publish-task-ignores-projects-setting
yy