【问题标题】:Two projects in one repository一个存储库中的两个项目
【发布时间】:2019-12-22 02:50:28
【问题描述】:

我将 Azure DevOps Pipelines 与 GitVersion 结合使用。

我有一个 git 存储库,文件夹中有两个项目:

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

我的 pipeline.yml 的开头是这样的:

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'

随后是 dotnet restore、build 等。

我的问题是让我们说 ProjectA 通过提交获取版本“-alpha12”。 然后我提交给 ProjectB,它得到的版本是“-alpha13”。 但这两个项目是相互独立的,版本也应该如此。

我提到的是,gitversion.yml 没有路径,我认为构建过程只是使用默认值。 但我不知道如何指定 gitversion.yml 的路径,也不知道这是否能解决我的问题。

有人可以帮我吗?

【问题讨论】:

    标签: azure-devops continuous-integration azure-pipelines gitversion build-pipeline


    【解决方案1】:

    简单地说,这是行不通的。

    GitVersion 旨在为运行它的整个存储库声明一个版本号。它对该存储库中存在的不同项目一无所知,因此无法为它们声明不同的版本号。

    您只会从 GitVersion 获得一个版本号。

    建议将项目 A 和 B 拆分为单独的存储库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-30
      • 1970-01-01
      • 2013-06-27
      • 2014-11-11
      • 1970-01-01
      • 1970-01-01
      • 2013-05-08
      相关资源
      最近更新 更多