I'm having a problem (unwanted behavior) when running an Azure Build Pipeline with the following project/folder structure.
My repository's root folder has two main folders:
- frontend (ASP.Net Core 2.x & Angular 7 project)
- backend (ASP.Net Core 2.x)
I'm trying to build two separate Azure Pipelines one for the backend and one for the frontend, so I use the projects:
parameter to specify the correct path.
The build
and test
commands are running fine and are only restoring/building/testing the backend
folder, but the publish
command is running for both folders: backend & frontend.
This is my yaml file:
#build backend project
task: DotNetCoreCLI@2
displayName: dotnet build --configuration $(buildConfiguration)
name: BuildBackendProject
inputs:
command: build
projects: '**/backend/**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
... #run some tests
#publish backend project
task: DotNetCoreCLI@2
displayName: dotnet publish backend --configuration $(buildConfiguration)
name: PublishBackendProject
inputs:
command: publish
projects: '**/backend/**/*.csproj'
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output
$(Build.ArtifactStagingDirectory)/backend'
zipAfterPublish: True
I tried different folder paths but it's always running two publish commands.
If I run locally in CMD dotnet publish backend
(from repo's root folder) it works fine but apparently that doesn't work with the Azure Pipeline.
Any ideas or fixes greatly appreciated.