Skip to content

Instantly share code, notes, and snippets.

@joncloud
Last active December 12, 2017 17:37
Show Gist options
  • Select an option

  • Save joncloud/6371db32c9fddf1bb0ffa0106ae5e6ca to your computer and use it in GitHub Desktop.

Select an option

Save joncloud/6371db32c9fddf1bb0ffa0106ae5e6ca to your computer and use it in GitHub Desktop.
$Prefix = Get-ChildItem -Recurse -Depth 2 -Filter *.csproj `
| ForEach-Object { [Xml]$A = $_ | Get-Content; $A.Project.PropertyGroup.VersionPrefix } `
| Where-Object { $_ -ne $null -and $_ -ne '' } `
| Select-Object -First 1
If ($IsBeta -eq "1") {
$Parts = $BuildNumber.Split('.')
$Date = $Parts[0]
$Sequence = $Parts[1] / 1
$Suffix = "-beta" + $Date + $Sequence.ToString("000")
}
Else {
$Suffix = ""
}
Write-Host "Using Package Version $Prefix$Suffix"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$Prefix$Suffix"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment