GitTools / GitVersion

From git log to SemVer in no time
https://gitversion.net/docs/
MIT License
2.81k stars 643 forks source link

[ISSUE]: GitVersion.MsBuild: Adding the nuget package to a SDK style project results gitversion.exe MyProj -outputfile obj\gitversion.json exited with code 1. #4086

Open evya-dev opened 3 weeks ago

evya-dev commented 3 weeks ago

Prerequisites

GitVersion package

GitVersion.MsBuild

GitVersion version

5.6.8-5.12.0

Operating system

Windows

What are you seeing?

When adding the nuget package for GitVersion.MsBuild into my project throws an error in the Error List Window:

Error MSB3073 The command ""\packages\gitversion.msbuild\5.6.8\tools\net48/gitversion.exe" "ProjectName" -output file -outputfile obj\gitversion.json" exited with code 1. \packages\gitversion.msbuild\5.6.8\tools\GitVersion.MsBuild.targets 9

I tried running the command through the CLI and I got the following when using version 5.6.8: unsupported repository version 1. Only version up to 0 are supported.

I tried running the same command but with the latest version 5.12.0 and I got the following error: unsupported extension name extensions.worktreeconfig

My repo is cloned from BitBucket cloud. I am using Visual Studio 2019. The project is a SDK style project with TFM of net451.

What is expected?

The gitversion.exe should support git config core.repositoryformatversion=1 and extensions.worktreeconfig=true.

Steps to Reproduce

Clone a .NET framework or .NET core project on a repo that has git config with core.repositoryformatversion=1 and extensions.worktreeconfig=true. Currently this is what my git repo has on BitBucket cloud. Open the project in Visual Studio 2019 and then add the GitVersion.MsBuild nuget package (any version from 5.6.8 to 5.12.0). Observe the error in the Error List window of the IDE.

RepositoryFixture Test

No response

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

No response

evya-dev commented 2 weeks ago

If I do a gitversion init I get the following (where SomeProject has a .git folder):

INFO [07/08/24 18:18:11:13] Working directory: C:\SomeProject\packages\gitversion.msbuild\5.12.0\tools\net48 unsupported extension name extensions.worktreeconfig INFO [07/08/24 18:18:11:18] Done writing

evya-dev commented 2 weeks ago

This is an upstream issue in libgit2sharp library (which at the time of this comment is at version 0.3.0). libgit2sharp 0.3.0 already has support for core.repositoryformatversion=1 but does not support extensions.worktreeconfig=true.

libgit2 has added this feature (core.repositoryformatversion=1 and extensions.worktreeconfig=true): https://github.com/libgit2/libgit2/issues/6044

Next steps is to bring this downstream to libgit2Sharp and then into GitVersion.LibGit2Sharp project.

evya-dev commented 2 weeks ago

The issue in libgit2Sharp has been created here: https://github.com/libgit2/libgit2sharp/issues/2109