-
Notifications
You must be signed in to change notification settings - Fork 0
/
Update-Version.ps1
37 lines (31 loc) · 1.19 KB
/
Update-Version.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$configFiles = Get-ChildItem . *.csproj -rec
$affectedFiles = New-Object "System.Collections.Generic.List``1[string]"
# Manually alter the build number before pushing to NuGet feeds
$previousBuild = "3.0.0-preview-002"
$currentBuild = "3.0.0"
foreach ($file in $configFiles)
{
$content = Get-Content $file.PSPath
if($content -like "*<Version>" + $previousBuild + "</Version>*")
{
$affectedFiles.Add($file.Name)
$content -replace ("<Version>" + $previousBuild + "</Version>"), ("<Version>" + $currentBuild + "</Version>") | Set-Content $file.PSPath
}
# Ensure Copyright year is correct
if($content -like "*<Copyright>Zinofi Digital Ltd 2018</Copyright>*")
{
$affectedFiles.Add($file.Name)
$content -replace ("<Copyright>Zinofi Digital Ltd 2018</Copyright>"), ("<Copyright>Zinofi Digital Ltd 2019</Copyright>") | Set-Content $file.PSPath
}
}
Write-Output ""
Write-Output "Updating from $($previousBuild) to $($currentBuild)"
Write-Output ""
Write-Output "Total files: $($configFiles.Length)"
Write-Output "Total affected files: $($affectedFiles.Count)"
Write-Output ""
if(!$affectedFiles.Count.Equals(0))
{
Write-Output "Affected Files:"
$affectedFiles | ForEach-Object { Write-Output $_ }
}