Skip to content

Commit 7be1607

Browse files
committed
(build) Handle null value for PreReleaseLabel
Depending on what branch is in play, the PreReleaseLabel may not contain a value, as such, we need to handle when this hasn't been set, and only attempt to grab a prerelease value when there is known to be one.
1 parent a543999 commit 7be1607

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

BuildScripts/default.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ task Run-GitVersion {
6767
# Having a pre-release label of greater than 10 characters can cause problems when trying to run choco pack.
6868
# Since we typically only see this when building a local feature branch, or a PR, let's just trim it down to
6969
# the 10 character limit, and move on.
70-
$prerelease = $versionInfo.PreReleaseLabel.Replace("-","").Substring(0,10)
70+
if ($versionInfo.PreReleaseLabel) {
71+
$prerelease = $versionInfo.PreReleaseLabel.Replace("-","").Substring(0,10)
72+
}
7173

7274
# Chocolatey doesn't support a prerelease that starts with a digit.
7375
# If we see a digit here, merely replace it with an `a` to get around this.

0 commit comments

Comments
 (0)