I have a repository with many solutions in it. I'd like to set up a build pipeline in Azure DevOps and build specific solution. I only need the "standard" steps as "restore packages, build, run unit tests, publish". However, the "publish" step gives me a headache.
The folder hierarchy for the repository looks like this:
src
- Solution1
- Project1
- Project2
- Project3
- Solution2
- Project4
- Project5
...
My goal would be to publish only the projects of e.g. Solution2 - so Project4 and Project5. Setting the value of workingDirectory
to "src/Solution2" or "$(System.DefaultWorkingDirectory)/src/Solution2" don't work as I expected.
Here's the definition of the build step.
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
workingDirectory: src/Solution2
In the logs, I see
"C:\Program Files\dotnet\dotnet.exe" publish [path_to_agent]_work\1\s\src\Solution1\Project1\Project1.csproj --configuration Release --output [path_to_agent]_work\1\a\Project1
and similar entries for every single project in the repository.
As a workaround I tried using the "custom" command, but it didn't work out either.
- task: DotNetCoreCLI@2
displayName: 'Publish'
inputs:
command: custom
arguments: 'src/Solution2 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory) '
custom: publish
This produces a log entry as
"C:\Program Files\dotnet\dotnet.exe" publish [path_to_agent]_work\1\s\src\Solution1\Project1\Project1.csproj src/Solution2 --configuration Release --output [path_to_agent]_work\1\a\Project1
and eventually the pipeline fails as Only one project can be specified
.
Any ideas what I'm doing wrong?