Skip to content

Commit

Permalink
fixed version build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Solnica committed Aug 30, 2016
1 parent 0f4e65a commit f5c6f22
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/Update-AssemblyInfoVersionFiles.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Update-AssemblyInfoVersionFiles
function Update-AssemblyInfoVersionFiles ([string]$versionIdentifier)
{
$local:srcPath = $env:BUILD_SOURCESDIRECTORY
$local:buildNumber = $env:BUILD_BUILDNUMBER
Expand All @@ -7,14 +7,14 @@ function Update-AssemblyInfoVersionFiles

foreach ($file in $(Get-ChildItem $srcPath AssemblyInfo.cs -recurse))
{
$local:r = [regex]"AssemblyFileVersion\(""([0-9]+\.[0-9]+)(\.([0-9]+|\*))+""\)"
$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($_, "AssemblyFileVersion(""`$1.$buildNumber"")")
$local:s = $r.Replace($_, "$versionIdentifier(""`$1.$buildNumber"")")
Write-Host "Change version to $s"
$s
} else {
Expand All @@ -24,4 +24,5 @@ function Update-AssemblyInfoVersionFiles
}
}

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

0 comments on commit f5c6f22

Please sign in to comment.