Repository navigation
GitVersion.MSBuild with Packable .NET 8 project does not get valid SemVer #4110
Description
Activity
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_moeThis 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.
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 :)
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: {}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
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
- linked a pull request that will close this issueReplace underscores in branch specific labels #4135
on Jul 31, 2024 🎉 This issue has been resolved in version 6.0.1 🎉
The release is available on:Your GitReleaseManager bot 📦🚀
Reacted by peter-friedland-t2i
Prerequisites
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
mode: ContinuousDelivery branches: release: regex: ^release/.+|tag/.+rc\d+$ label: rc pull-request: label: pr ignore: sha: [] merge-message-formats: {}RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response