Skip to content

[BUG]: DotNetCoreCli@2 dotnet publish zipAfterPublish option doesn't support artifacts output layout (.NET 8) #21062

Open
@kwlin

Description

@kwlin

New issue checklist

Task name

DotNetCoreCli

Task version

V2

Issue Description

It seems the option "zipAfterPublish" doesn't support artifacts output layout (.NET 8 feature) when using command publish.

Current workaround is:

  • Explicit set zipAfterPublish on false
  • Zip published artifacts in the published folder based on artifacts layout with powershell or ArchiveFiles task

The issue seems to be in this method:

var files = tl.findMatch(path.dirname(projectFile), pattern);
It use the solution or project folder instead of the configured "ArtifactsPath" in directory.build.props

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

Ubuntu

Relevant log output

##[error]A publish folder could not be found to zip for project file: /mnt/agent/1/s/Src/<solutionname>.slnx.

Full task logs with system.debug enabled

 ##[debug]61 results
##[debug]found 61 paths
##[debug]applying include pattern
##[debug]adjustedPattern: '/mnt/agent/1/s/< folders >/**/publish'
##[debug]0 matches
##[debug]0 final results
##[debug]Zip Source: 
##[error]A publish folder could not be found to zip for project file: /mnt/agent/1/s/< folders >/< solution name >.slnx.
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=11a3fb92-2a08-4347-9694-641e0192ec1c;]A publish folder could not be found to zip for project file: /mnt/agent/1/s/< folders >/< solution name >.slnx.
 

Repro steps

configured directory.build.props in the root of git repository:

<Project>
  <PropertyGroup Label="Configure artifact folders">
    <UseArtifactsOutput>true</UseArtifactsOutput>
    <ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
    <!-- use default obj output folders or EF .NET CLI tools will break -->
    <UseArtifactsIntermediateOutput>false</UseArtifactsIntermediateOutput>
  </PropertyGroup>
</Project>

In the YAML file:

    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: false
        projects: '$(Build.SourcesDirectory)/< folders > /< solution name >.slnx'
        arguments: '--no-restore --configuration $(buildConfiguration) --verbosity normal'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions