Skip to content

[BUG]: DotNetCoreCLI@2 publish task always publishes all projects #19565

Closed
@dloukola

Description

New issue checklist

Task name

DotNetCoreCLI@2

Task version

2

Issue Description

Issue:
This task ALWAYS attempts to publish all executable projects in the solution, no matter what is specified in the "projects" argument.
It runs them as separate commands per project.

- task: DotNetCoreCLI@2
  displayName: "Build and Publish"
  inputs:
    command: publish
    projects: ${{ parameters.projects }}    
    arguments: '--configuration ${{ parameters.buildConfiguration }} --output $(Build.ArtifactStagingDirectory)/publish_output'
    zipAfterPublish: true

Expected:
Only the projects specified in the "projects" argument should be built and published.

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

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

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

windows-latest

Relevant log output

C:\Windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.

"C:\Program Files\dotnet\dotnet.exe" publish [ProjectFilePath1] --configuration release --output D:\a\1\a\publish_output\[ProjectFileName1]
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  Restored [ProjectFilePath1] (in 757 ms).
  
"C:\Program Files\dotnet\dotnet.exe" publish [ProjectFilePath2] --configuration release --output D:\a\1\a\publish_output\[ProjectFileName2]
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  Restored [ProjectFilePath2] (in 468 ms).

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

stages:
  - stage: Build
    displayName: Build
    
    jobs:
      - job: Build
        displayName: Build
        pool:
          vmImage: 'windows-latest'
        
        steps:
          - task: DotNetCoreCLI@2
            displayName: "Build and Publish"
            inputs:
              command: publish
              projects: [PathToProjectFile]  
              arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)/publish_output'
              zipAfterPublish: true

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