Skip to content

[ISSUE]: Long build time in Azure pipeline when using GitVersion.msbuild Nuget (6.3.0) #4661

@MattChique

Description

@MattChique

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.MsBuild

GitVersion version

6.3.0

Operating system

Windows

What are you seeing?

We have a .NET project referencing the gitVersion.msbuild Nuget package:

		<PackageReference Include="GitVersion.MsBuild" Version="6.3.0">
			<PrivateAssets>all</PrivateAssets>
			<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		</PackageReference>

Since an upgrade from 5.12.0 to 6.3.0 the build takes longer (45 s -> 9 min). We also tried 6.4.0, same here.
With logging enabled (dotnet build -p:reportanalyzer=true -v:diag) we clearly see that gitVersion is the cause:

      483 ms  OverrideRoslynCodeAnalysisProperties      13 calls
      505 ms  Restore                                    1 calls
      535 ms  InitializeSourceControlInformationFromSourceControlManager  13 calls
      654 ms  _CopyFilesMarkedCopyLocal                  7 calls
      722 ms  CopyFilesToOutputDirectory                13 calls
      768 ms  _GenerateRestoreProjectPathWalk           13 calls
      914 ms  GenerateBuildDependencyFile               12 calls
     1193 ms  SonarCategoriseProject                    13 calls
     1203 ms  SonarWriteFilesToAnalyze                  13 calls
     1290 ms  ResolveAssemblyReferences                 13 calls
     1475 ms  _GetProjectReferenceTargetFrameworkProperties  13 calls
    13167 ms  WebCompile                                 2 calls
    71667 ms  CoreCompile                               13 calls
    72629 ms  ResolveProjectReferences                  13 calls
    831570 ms  RunGitVersion                              1 calls

which finally ends (fails) with:

Async Command Start: Update Build Number
Async Command End: Update Build Number
##[error]TF209010: The build number format 0.9.0-bugfix-debug-long-build-time.1+156 (TaskId:233) contains invalid character(s), is too long, or ends with '.'. The maximum length of a build number is 255 characters. Characters which are not allowed include '"', '/', ':', '<', '>', '\', '|', '?', '@', and '*'.
Finishing: Build Windows Application

This triggers a failing pipeline, but only if setting dotnet build -p:reportanalyzer=true -v:diag, which we don't have outside of this branch where we check why the build time is so long.
We use a self hosted azure build agent on an windows 11 pc.
The .NET Host task on the build pc does not consume much ram and the cpu is only at 15% during the whole build time.

If we build it manually on the build pc using remote desktop it runs fine in a few seconds.

Our gitVersion.yml is pretty empty:

---
branches: {}
ignore:
  sha: []
  commits-before: 2022-07-01T00:00:00
merge-message-formats: {}

Also interesting: we have not set any tag targeting version 0.9.0, with 5.12.0 it is still 8.3.0.

What is expected?

I would expect, that the exec time should not go up like this, when upgrading to 6.3.0.

Steps to Reproduce

  • .NET 8 Windows project with gitVersion.msBuild 6.3.0
  • Build in self-hosted Azure pipeline

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions