0
votes

I have a .NET Core solution with two projects (proj1 and proj2). When I run a build in Azure DevOps, I use the DotNetCoreCLI@2 command like this:

    - task: DotNetCoreCLI@2
      displayName: 'Build output'
      inputs:
        command: 'build'
        projects: '**/*.csproj'
        arguments: '--output $(System.DefaultWorkingDirectory)/publish_output'

As is, all the artifacts from both builds end up in the publish_output directory. What I'd like is for there to be a proj1 and proj2 subdirectory created under publish_output and the artifacts from the projects placed appropriately.

Is this possible? I could not find a "currently being build project name" variable to append to the output directory.

1
Have you tried the modifyOutputPath input? See the DocumentationSimply Ged

1 Answers

0
votes

Thank you Simply Ged. Posting your suggestions as answer to help other community members.

Add modifyOutputPath as a input as below and check

enter image description here

Here is the code

# Publish projects to specified folder.
- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/*.csproj'
    arguments: '-o $(Build.ArtifactStagingDirectory)/Output'
    zipAfterPublish: true
    modifyOutputPath: true

Follow the Publish Projects for further instructions.