Solution for Per-project output directory with dotnet build (Azure DevOps)
is Given Below:
I have a .NET Core solution with two projects (
proj2). When I run a build in Azure DevOps, I use the [email protected] command like this:
- task: [email protected] 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
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.
Thank you Simply Ged. Posting your suggestions as answer to help other community members.
modifyOutputPath as a input as below and check
Here is the code
# Publish projects to specified folder. - task: [email protected] 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.