This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task default -depends GetBuildNumber | |
task GetBuildNumber { | |
Assert ($base_directory -ne $null) '$base_directory should not be null. Try %system.teamcity.build.checkoutDir%' | |
Assert ($solution_name -ne $null) '$solution_name should not be null' | |
$version = gc $base_directory\$solution_name\Properties\AssemblyInfo.cs | select-string -pattern "AssemblyVersion" | Out-String | |
$version | Foreach-Object { Write-Host $_ } | |
$version -imatch '\[assembly: Assembly(File)?Version\("(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<revision>[0-9]+)\.(?<build>[0-9]+)"\)\]' | Out-Null | |
Assert ($matches -ne $null) 'Unable to find AssemblyVersion string!' |