Reputation: 37
I have multiple projects inside a single web solution in visual studio. I have uploaded my entire solution in DevOps. Now I want to publish a specific project in artifact (not all the projects). Please let me know how can I do that. And also what specification is required in YAML files for this task?
Upvotes: 2
Views: 2960
Reputation: 40899
Here in project you should set your specific project which needs to be published:
# Publish projects to specified folder.
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: publish
publishWebProjects: false
projects: 'MyDirectory/MyProjectToBePublished.csproj'
arguments: '-o $(Build.ArtifactStagingDirectory)/Output'
zipAfterPublish: true
modifyOutputPath: true
Please remember about publishing pipeline artifacts.
If you want to publish all projects you need to change projects
input to this **/*.csproj
steps:
# 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
- task: PublishBuildArtifacts@1
and then you will get it multiple project published as artifacts:
Upvotes: 3
Reputation: 12999
How to publish a specific project in artifact?
You can search “publish artifact” task in your YAML review page then click the Publish build artifacts. Set the Path to publish to the path of the project you want to publish then add this task to YAML. You can also refer to my screenshot about the steps.
What specification is required in YAML files for this task?
We can add two triggers in YAML to specific the path of the project we want to include or exclude.
When we specify paths, we must explicitly specify branches to trigger on. You can't trigger a pipeline with only a path filter; you must also have a branch filter, and the changed files that match the path filter must be from a branch that matches the branch filter.
For more information, you can refer to this doc.
YAML trigger:
# specific path build
trigger:
branches:
include:
- master
- releases/*
paths:
include:
- docs/*
exclude:
- docs/README.md
Upvotes: 0