Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lowleveldesign committed Jun 3, 2019
1 parent 165b523 commit 98d35ba
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts/Update-AssemblyInfoVersionFiles.ps1
@@ -0,0 +1,28 @@
function Update-AssemblyInfoVersionFiles ([string]$versionIdentifier)
{
$local:srcPath = $env:BUILD_SOURCESDIRECTORY
$local:buildNumber = $env:BUILD_BUILDNUMBER

Write-Host "Executing Update-AssemblyInfoVersionFiles in path $srcPath for build $buildNumber"

foreach ($file in $(Get-ChildItem $srcPath AssemblyInfo.cs -recurse))
{
$local:r = [regex]"$versionIdentifier\(""([0-9]+\.[0-9]+)(\.([0-9]+|\*))+""\)"
$local:assemblyVersion = "0.0.0.0"
#version replacements
(Get-Content -Encoding utf8 $file.FullName) | % {
$m = $r.Matches($_)
if ($m -and $m.Success) {
$assemblyVersion = "$($m.Groups[1].Value).$buildNumber"
$local:s = $r.Replace($_, "$versionIdentifier(""`$1.$buildNumber"")")
Write-Host "Change version to $s"
$s
} else {
$_
}
} | Set-Content -Encoding utf8 $file.FullName -Force
}
}

Update-AssemblyInfoVersionFiles "AssemblyFileVersion" -Verbose
Update-AssemblyInfoVersionFiles "AssemblyVersion" -Verbose

0 comments on commit 98d35ba

Please sign in to comment.