-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastian Solnica
committed
Oct 21, 2016
1 parent
7171c4d
commit 68f2679
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |