Reputation: 1
I have a solution in .Net core containing multiple projects.
We are using the Azure pipelines using Azure DevOPS and we need to have a complete separate build pipelines for each of the mentioned projects. I have tried to use "Path Filters" but couldn't accomplish this. My pipeline creates a drop from the whole solution. Already reviewed this but not found the solution.
Can anyone help on this?
The Source Code Path
Azure DevOPS CI Pipeline
Upvotes: 0
Views: 1991
Reputation: 13469
On the .Net build task, you can set the value of the field "Path to project(s)
" to be the path of a specified project in the solution. The wildcard expression "**/*.csproj
" will match and build all the C# projects in the solution.
For your case, after .Net build task, the you need to use the Copy Files task to copy the artifact files from the build output path to $(Build.ArtifactStagingDirectory)
.
Then use the **Publish Artifacts task ** to publish the artifact files from $(Build.ArtifactStagingDirectory)
.
Upvotes: 1
Reputation: 580
we use this code to achieve that for our multi-project solution:
trigger:
branches:
include:
- master
paths:
include:
- src/Project1
pool:
name: 'Default'
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build src\Project1\Project1.csproj --configuration $(buildConfiguration)
displayName: 'Building. Configuration: "$(buildConfiguration)"'
name: 'build_solution'
continueOnError: 'false'
- script: dotnet test src\Project1\Project1.csproj --no-build --configuration $(buildConfiguration)
displayName: 'Running tests'
name: 'run_tests'
continueOnError: 'false'
- task: DotNetCoreCLI@2
displayName: 'Publishing'
name: 'publish'
continueOnError: false
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/Project1.csproj'
arguments: '--configuration $(BuildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifact'
name: 'publish_build_artifact'
continueOnError: false
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Project1'
publishLocation: 'Container'
Upvotes: 0