Skip to content

[Question]: Why is the default for 'publishWebProjects` true when publishing? #21128

Open
@harry-shotter

Description

@harry-shotter

Task name

DotNetCoreCLI

Task version

2.235.0

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure Devops Server 2022.2

Operation system

Windows Server 2022 Standard

Question

I've recently migrated part of a legacy repository from .NET Framework 4.6.2 to .NET 8. This has left me with a mixed repository that I'm attempting to build.

The repository includes a mix of:

  • ASP.NET Web App (.NET Framework 4.6.2)
  • ASP.NET Core Web API (.NET 8)
  • Console Application (.NET 8)

While attempting to build this, I used the DotNetCoreCLI@2 task with the publish command and a specific project specified. The task might look like:

  - task: dotnetCoreCLI@2
    displayName: 'Publish .NET 8 project'
    inputs:
      command: 'publish'
      projects: 'src/Modern.API.csproj'
      arguments: '--configuration $(BuildConfiguration) --no-restore'

However, the task would fail as it would also attempt to publish my legacy .NET Framework ASP.NET application as its not compatible with dotnet publish.

After some investigation, I found the publishWebProjects option in the docs and noticed that this had some unexpected side effects:

  1. It is used when the publish command is used
  2. It would ignore any projects specified
  3. It defaults to true

So, while I can get around my problem by setting this to false, it's caused me some pain and I'm unsure why/if this is the intended behaviour?

Would it make more sense to default publishWebProjects to false for more predictable behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions