2

I use Azure DevOps Pipelines with GitVersion.

I have one git repository with two projects in folders:

ProjectA/ProjectA.csproj
ProjectA/azure-pipelines.yml
ProjectA/gitversion.yml
ProjectB/ProjectB.csproj
ProjectB/azure-pipelines.yml
ProjectB/gitversion.yml

The beginning of my pipeline.yml looks like this:

trigger:
  branches:
    include:
    - '*'
  paths:
    include:
    - 'ProjectA' <-- ProjectB in the other file

# Setup everything
steps:
- task: NuGetCommand@2
  displayName: 'Install GitVersion CLI Tool'
  inputs:
    command: custom
    arguments: install GitVersion.CommandLine -Version 5.0.0 -OutputDirectory $(Build.BinariesDirectory)/tools -ExcludeVersion  

- task: UseDotNet@2
  displayName: 'Install .NET Core SDK 3.0'
  inputs:
    packageType: 'sdk'
    version: '3.x'
    includePreviewVersions: true


# Execute the GitVersion Tool
- script: mono $(Build.BinariesDirectory)/tools/GitVersion.CommandLine/tools/GitVersion.exe /output buildserver /nofetch
  displayName: 'Execute GitVersion CLI Tool'

followed by dotnet restore, build and so on.

My issue is let's say ProjectA get's the version "-alpha12" through commits. And then I commit to ProjectB it get's the version "-alpha13". But these two projects are independent from each other and so should the version.

What I mentioned is, there is nowhere a path to the gitversion.yml and I think the build process is just working with defaults. But I don't know how to specify the path to the gitversion.yml and don't know if that would solve my issue.

Can someone help me?

riQQ
  • 9,878
  • 7
  • 49
  • 66
XdX Software
  • 73
  • 1
  • 5

1 Answers1

2

Simply put, this isn't going to work.

GitVersion is intended to assert a single version number for the entire repository it is being run against. It doesn't know anything about the different projects that exist within that repository, and therefore it can't assert a different version number for them.

You will only ever get a single version number from GitVersion.

The recommendation would be to split Project A and B into separate repositories.

Gary Ewan Park
  • 17,610
  • 5
  • 42
  • 60