0
votes

I am having a weird issue when trying to publish my .NET Core 3.1 Web Api. In my YAML file I have added this to publish my project:

- task: DotNetCoreCLI@2
inputs:
command: 'publish'
projects: 'BITSolutions.InvoiceTool.Service\BITSolutions.InvoiceTool.Service.csproj'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
outputDir: '$(Build.ArtifactStagingDirectory)'

Everytime I run my build pipeline using this task, the task is executing the following line:

"C:\Program Files\dotnet\dotnet.exe" publish D:\a\1\s\BITSolutions.InvoiceTool.Web\BITSolutions.InvoiceTool.Web.csproj --configuration Release --output D:\a\1\a\BITSolutions.InvoiceTool.Web

It is publishing my Blazor Server project instead of my Service web api project as I stated in the task.

Any idea why?

Thanks in advance!

1
Can you add logs?Krzysztof Madej
Try to disable the option Publish web projects in the dotnet publish task.Leo Liu-MSFT

1 Answers

2
votes

Not really a Blazor issue, more DevOps/YAML question.

The DotNetCoreCLI@2 task has a publishWebProjects parameter which defaults to true if not specified.

See https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops

Add the line

  publishWebProjects: false

to the task, that should fix it.