Skip to content

Commit

Permalink
use regex to replace all invalid chars
Browse files Browse the repository at this point in the history
As suggested by @tobsil
  • Loading branch information
smorokin authored and kzu committed Aug 2, 2023
1 parent 9922765 commit a9ccf1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GitInfo/build/GitInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@

<Target Name="GitSetVersion" DependsOnTargets="GitVersion" Condition="'$(GitVersion)' != 'false'">
<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)+$(GitBranch.Replace('/', '-').Replace('\', '-').Replace('_', '-').$(GitCommit)</Version>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)+$([System.Text.RegularExpressions.Regex]::Replace($(GitBranch), "[^0-9A-Za-z-]", "-")).$(GitCommit)</Version>
<PackageVersion>$(Version)</PackageVersion>
</PropertyGroup>
</Target>
Expand Down

0 comments on commit a9ccf1c

Please sign in to comment.