forked from stevencohn/OneMore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setversion.ps1
43 lines (36 loc) · 1.58 KB
/
setversion.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
38
39
40
41
42
43
<#
.SYNOPSIS
Set the version of OneMore, OneMoreProtocolHandler, and OneMoreSetup
.PARAMETER version
The version string to apply. Must be of the form major.minor or major.minor.patch
#>
param (
[Parameter(Mandatory = $true)]
[ValidatePattern({^\d+\.\d+(?:\.\d+)?$})]
[string] $version
)
Begin
{
}
Process
{
$0 = '.\OneMore\Properties\AssemblyInfo.cs'
$content = (Get-Content $0) -replace 'Version = "\d+\.\d+(?:\.\d+)?";',"Version = ""$version"";"
$content | Out-File $0 -Force
$0 = '.\OneMoreCalendar\Properties\AssemblyInfo.cs'
$content = (Get-Content $0) -replace 'Version = "\d+\.\d+(?:\.\d+)?";',"Version = ""$version"";"
$content | Out-File $0 -Force
$0 = '.\OneMoreProtocolHandler\Properties\AssemblyInfo.cs'
$content = (Get-Content $0) -replace 'Version = "\d+\.\d+(?:\.\d+)?";',"Version = ""$version"";"
$content | Out-File $0 -Force
$0 = '.\OneMoreSetupActions\Properties\AssemblyInfo.cs'
$content = (Get-Content $0) -replace 'Version = "\d+\.\d+(?:\.\d+)?";',"Version = ""$version"";"
$content | Out-File $0 -Force
$0 = '.\OneMoreSetup\OneMoreSetup.vdproj'
$guid1 = [Guid]::NewGuid().ToString('B').ToUpper()
$guid2 = [Guid]::NewGuid().ToString('B').ToUpper()
$content = (Get-Content $0) -replace '"ProductVersion" = "8:\d+\.\d+(?:\.\d+)?"',"""ProductVersion"" = ""8:$version"""
$content = $content -replace '"ProductCode" = "8:{[A-F0-9-]+}"',"""ProductCode"" = ""8:$guid1"""
$content = $content -replace '"PackageCode" = "8:{[A-F0-9-]+}"',"""PackageCode"" = ""8:$guid2"""
$content | Out-File $0 -Force
}