Refactor GitVersion configuration in project file to prioritize safe version composition from MSBuild properties

This commit is contained in:
MaddoScientisto 2026-02-15 19:45:46 +01:00
commit daead29d31

View file

@ -13,7 +13,9 @@
<RepositoryUrl>https://gitlab.com/MaddoScientisto/aifotoonlus</RepositoryUrl>
<!-- Use GitVersion MSBuild properties to set package version during CI/build. Provide fallback if variable is not defined.
Sanitize the GitVersion output to remove characters invalid for NuGet (e.g., braces) -->
<GitVersionRaw>$(GitVersion_NuGetVersionV2)</GitVersionRaw>
<!-- Prefer composing a safe version from concrete GitVersion MSBuild properties when available -->
<GitVersionRaw Condition="'$(GitVersion_MajorMinorPatch)' != ''">$(GitVersion_MajorMinorPatch)-$(GitVersion_EscapedBranchName).$(GitVersion_PreReleaseNumber)</GitVersionRaw>
<GitVersionRaw Condition="'$(GitVersionRaw)' == ''">$(GitVersion_NuGetVersionV2)</GitVersionRaw>
<GitVersionSanitized>$([System.Text.RegularExpressions.Regex]::Replace('$(GitVersionRaw)','[{}]',''))</GitVersionSanitized>
<Version Condition="'$(GitVersionSanitized)' != ''">$(GitVersionSanitized)</Version>
<Version Condition="'$(GitVersionSanitized)' == ''">0.1.0</Version>