<p>I have solved this issue, it had to do with the path to the pipeline.</p>
<p>I created a directory called pipelines/dev and pipelines/prod in the root of my repo. And I pointed either build pipeline to the respective yaml config file. Now it will only build on the commit of the specific branches.</p>

CC BY-SA 4.0
2020-07-22T23:53:28.953Z
2020-07-22T23:53:28.953Z
nulltron
<p>I'm attempting to build different branches with different YAML configuration files in each branch. However, when I commit to a branch that should only trigger 1 pipeline it triggers both.</p>
<p><a href="https://i.sstatic.net/Gqbn1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Gqbn1.png" alt="Project Pipelines" /></a></p>
<p>Development YAML:</p>
<pre><code>    trigger:
    - master_Development
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
      buildPackageDirectory: 'packages'
      nugetConfig: 'SW.Api.Net/nuget.config'
    
    steps:
    
    - task: NuGetToolInstaller@0
      displayName: 'Use NuGet 4.4.1'
      inputs:
        versionSpec: 4.4.1
    
    - task: NuGetCommand@2
      displayName: 'NuGet restore'
      inputs:
        restoreSolution: $(solution)
        feedsToUse: config
        nugetConfigPath: $(nugetConfig)
        externalFeedCredentials: TelerikFeed
        restoreDirectory: $(buildPackageDirectory)
    
    - task: VSBuild@1
      displayName: 'Build solution'
      inputs:
        solution: $(solution)
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=&quot;$(build.artifactStagingDirectory)\\&quot;'
        platform: $(buildPlatform)
        configuration: $(buildConfiguration)
    
    - task: VSTest@2
      displayName: 'Test Assemblies'
      inputs:
        testFiltercriteria: 'TestCategory=Unit Test'
        platform: $(buildPlatform)
        configuration: $(buildConfiguration)
    
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'
      inputs:
        PathToPublish: $(build.artifactStagingDirectory)
        ArtifactName: 'drop'
      condition: succeededOrFailed()


Production YAML:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  buildPackageDirectory: 'packages'
  nugetConfig: 'SW.Api.Net/nuget.config'

steps:

- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.4.1'
  inputs:
    versionSpec: 4.4.1

- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: $(solution)
    feedsToUse: config
    nugetConfigPath: $(nugetConfig)
    externalFeedCredentials: TelerikFeed
    restoreDirectory: $(buildPackageDirectory)

- task: VSBuild@1
  displayName: 'Build solution'
  inputs:
    solution: $(solution)
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=&quot;$(build.artifactStagingDirectory)\\&quot;'
    platform: $(buildPlatform)
    configuration: $(buildConfiguration)

- task: VSTest@2
  displayName: 'Test Assemblies'
  inputs:
    testFiltercriteria: 'TestCategory=Unit Test'
    platform: $(buildPlatform)
    configuration: $(buildConfiguration)

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathToPublish: $(build.artifactStagingDirectory)
    ArtifactName: 'drop'
  condition: succeededOrFailed()
</code></pre>
<p>Why would the pipelines not be separately triggering they target different branches?</p>

<azure-devops><azure-pipelines><yaml>
Azure DevOps Pipelines running on incorrect branches
nulltron
# Azure DevOps Pipelines running on incorrect branches

(Asked by: username_0 on 2020-07-22)

I'm attempting to build different branches with different YAML configuration files in each branch. However, when I commit to a branch that should only trigger 1 pipeline it triggers both.

Development YAML:
    trigger:
    - master_Development
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
      buildPackageDirectory: 'packages'
      nugetConfig: 'SW.Api.Net/nuget.config'
    
    steps:
    
    - task: NuGetToolInstaller@0
      displayName: 'Use NuGet 4.4.1'
      inputs:
        versionSpec: 4.4.1
    
    - task: NuGetCommand@2
      displayName: 'NuGet restore'
      inputs:
        restoreSolution: $(solution)
        feedsToUse: config
        nugetConfigPath: $(nugetConfig)
        externalFeedCredentials: TelerikFeed
        restoreDirectory: $(buildPackageDirectory)
    
    - task: VSBuild@1
      displayName: 'Build solution'
      inputs:
        solution: $(solution)
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)\\"'
        platform: $(buildPlatform)
        configuration: $(buildConfiguration)
    
    - task: VSTest@2
      displayName: 'Test Assemblies'
      inputs:
        testFiltercriteria: 'TestCategory=Unit Test'
        platform: $(buildPlatform)
        configuration: $(buildConfiguration)
    
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'
      inputs:
        PathToPublish: $(build.artifactStagingDirectory)
        ArtifactName: 'drop'
      condition: succeededOrFailed()


Production YAML:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  buildPackageDirectory: 'packages'
  nugetConfig: 'SW.Api.Net/nuget.config'

steps:

- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.4.1'
  inputs:
    versionSpec: 4.4.1

- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: $(solution)
    feedsToUse: config
    nugetConfigPath: $(nugetConfig)
    externalFeedCredentials: TelerikFeed
    restoreDirectory: $(buildPackageDirectory)

- task: VSBuild@1
  displayName: 'Build solution'
  inputs:
    solution: $(solution)
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)\\"'
    platform: $(buildPlatform)
    configuration: $(buildConfiguration)

- task: VSTest@2
  displayName: 'Test Assemblies'
  inputs:
    testFiltercriteria: 'TestCategory=Unit Test'
    platform: $(buildPlatform)
    configuration: $(buildConfiguration)

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathToPublish: $(build.artifactStagingDirectory)
    ArtifactName: 'drop'
  condition: succeededOrFailed()

Why would the pipelines not be separately triggering they target different branches?

**Tags:** azure-devops, azure-pipelines, yaml


---

## 1 answers

### Answer by username_0 on 2020-07-22. Score: 1

I have solved this issue, it had to do with the path to the pipeline.

I created a directory called pipelines/dev and pipelines/prod in the root of my repo. And I pointed either build pipeline to the respective yaml config file. Now it will only build on the commit of the specific branches.


---

