Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drlongnecker/440646 to your computer and use it in GitHub Desktop.
Save drlongnecker/440646 to your computer and use it in GitHub Desktop.
task GetBuildNumber {
$version = gc $base_directory\$solution_name\Properties\AssemblyInfo.cs | select-string -pattern "AssemblyVersion"
$version -match '^\[assembly: AssemblyVersion\(\"(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<revision>[0-9]+)\.(?<build>[0-9]+)\"\)\]' | Out-Null
"##teamcity[buildNumber '{0}.{1}.{2}.{3}']" -f $matches["major"],$matches["minor"],$matches["revision"],$matches["build"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment