Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitVersion.MSBuild with Packable .NET 8 project does not get valid SemVer #4110

Closed
2 tasks done
peter-friedland-t2i opened this issue Jul 23, 2024 · 6 comments · Fixed by #4135
Closed
2 tasks done
Labels
Milestone

Comments

@peter-friedland-t2i
Copy link

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.0.0

Operating system

Windows

What are you seeing?

I cannot build any more after updating to gitversion 6.0.0 using the corresponding msbuild task, because the build complains about an invalid package version (I had to translate german error message to english: System.ArgumentException: the PackageVersion character sequence "0.6.0-HYP-719_update_gitversion.1+27" is invalid. Seems like its using the FullSemVer rather than SemVer. See gitversion output:

{ "AssemblySemFileVer": "0.6.0.0", "AssemblySemVer": "0.6.0.0", "BranchName": "feature/HYP-719_update_gitversion", "BuildMetaData": 27, "CommitDate": "2024-07-23", "CommitsSinceVersionSource": 27, "EscapedBranchName": "feature-HYP-719-update-gitversion", "FullBuildMetaData": "27.Branch.feature-HYP-719-update-gitversion.Sha.e76a9b28e6258a87b32e44279fa902afb216134a", "FullSemVer": "0.6.0-HYP-719_update_gitversion.1+27", "InformationalVersion": "0.6.0-HYP-719_update_gitversion.1+27.Branch.feature-HYP-719-update-gitversion.Sha.e76a9b28e6258a87b32e44279fa902afb216134a", "Major": 0, "MajorMinorPatch": "0.6.0", "Minor": 6, "Patch": 0, "PreReleaseLabel": "HYP-719_update_gitversion", "PreReleaseLabelWithDash": "-HYP-719_update_gitversion", "PreReleaseNumber": 1, "PreReleaseTag": "HYP-719_update_gitversion.1", "PreReleaseTagWithDash": "-HYP-719_update_gitversion.1", "SemVer": "0.6.0-HYP-719_update_gitversion.1", "Sha": "e76a9b28e6258a87b32e44279fa902afb216134a", "ShortSha": "e76a9b2", "UncommittedChanges": 0, "VersionSourceSha": "0009dd4c353672803f36f7ea2e3a6ccd793d8203", "WeightedPreReleaseNumber": 30001 }

What is expected?

Build works and version of the build nuget package is 0.6.0-HYP-719_update_gitversion.1, not 0.6.0-HYP-719_update_gitversion.1+27 which is invalid.

Steps to Reproduce

  1. having a dotnet 8 class library project
  2. adding Gitversion.MSBuild 6.0.0
  3. add gitversion.yml as follows:
    mode: ContinuousDelivery branches: release: regex: ^release/.+|tag/.+rc\d+$ label: rc pull-request: label: pr ignore: sha: [] merge-message-formats: {}
  4. mark project as packable
  5. call dotnet pack

RepositoryFixture Test

No response

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

No response

@MoeHamdan
Copy link

MoeHamdan commented Jul 23, 2024

In my case I am getting the below
GitVersion = {
FullSemVer: 0.0.1-TAS-42_moe.1+32
LegacySemVer: [NULL]
MajorMinorPatch: 0.0.1
InformationalVersion: 0.0.1-TAS-42_moe.1+32.Branch.feature-TAS-42-moe.Sha.4c5956176653703fe32ed44fb6c1a6f0fdd28f1e
Nuget v2 version: [NULL]
PreReleaseLabel: TAS-42_moe
BuildMetaData: 32
}
Version to use: 0.0.1.32-TAS-42_moe

This is wrong it should be 0.1.0.32-TAS-42-moe, I have fall back to version 5.12.0 to get the correct version and my build starts working.

@peter-friedland-t2i
Copy link
Author

its also our solution to fall back at the moment, but there should be a fix otherwise no-one can build build nuget packages with V6, unless there is a workaround for the gitversion config :)

@gamblen
Copy link

gamblen commented Jul 25, 2024

I am having a similar problem as FullSemVer has changed from v5.12.0, using it for tags on docker images and for nuget.

Specifically feature branches.

With version 5.12.0
"FullSemVer": "1.6.0-MyFeature.27"

With version 6.0.0
"FullSemVer": "1.6.0-MyFeature.1+27"

The addition of the 1+ causes docker build to abort and nuget to label as 1.6.0-MyFeature.1 which is overriding the first change in the feature branch.

My config is

assembly-versioning-scheme: MajorMinorPatchTag
mode: ContinuousDeployment
branches: {}
ignore:
  sha: []
merge-message-formats: {}

@vinnyrose
Copy link
Contributor

vinnyrose commented Jul 31, 2024

The issue is the underscores in the branch name. So, the workaround is to not use underscores in the branch name.

Underscores used to be replaced by a dash but since underscores were added to the allowed characters in a branch name in 9ede034 to facilitate certain regex patterns, underscores are no longer replaced. Seems like a simple replace might fix it: vinnyrose/GitVersion@main...feature/underscore-label-fix

ref: #3687

@arturcic
Copy link
Member

The issue is the underscores in the branch name. So, the workaround is to not use underscores in the branch name.

Underscores used to be replaced by a dash but since underscores were added to the allowed characters in a branch name in 9ede034 to facilitate certain regex patterns, underscores are no longer replaced. Seems like a simple replace might fix it: vinnyrose/GitVersion@main...feature/underscore-label-fix

ref: #3687

@vinnyrose thank you for taking the time to understand the issue, please submit the PR and if the build succeeds I think it can be merged

@arturcic
Copy link
Member

arturcic commented Aug 5, 2024

🎉 This issue has been resolved in version 6.0.1 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants