1
+ [CmdletBinding ()]
2
+ Param (
3
+ [Parameter (Mandatory = $True , Position = 0 )]
4
+ [String ]$Version ,
5
+ [Parameter (Mandatory = $True , Position = 1 )]
6
+ [String ]$Release ,
7
+ [Parameter (Mandatory = $False , Position = 2 )]
8
+ [String ]$Folder
9
+ )
10
+
11
+ function SetMsiVersion ([string ]$FilePath , [string ]$MsiVersion )
12
+ {
13
+ $wxsPath = Join-Path $FilePath " azurecmd.wxs"
14
+
15
+ Write-Output " Updating File: $wxsPath "
16
+ $content = Get-Content $wxsPath
17
+ $matches = ([regex ]::matches($content , ' \<\?define version="([\d\.]+)" \?\>' ))
18
+
19
+ $prevousVersion = $matches.Groups [1 ].Value
20
+
21
+ $content = $content.Replace (" <?define version=`" $prevousVersion `" ?>" , " <?define version=`" $MsiVersion `" ?>" )
22
+
23
+ Set-Content - Path $wxsPath - Value $content - Encoding UTF8
24
+ }
25
+
26
+ function SetMsiReleaseString ([string ]$FilePath , [string ]$MsiRelease )
27
+ {
28
+ $wxsPath = Join-Path $FilePath " azurecmd.wxs"
29
+
30
+ Write-Output " Updating File: $wxsPath "
31
+ $content = Get-Content $wxsPath
32
+ $matches = ([regex ]::matches($content , ' \<\?define productName="Microsoft Azure PowerShell - ([a-zA-z]+\s[\d]+)" \?\>' ))
33
+
34
+ $prevousVersion = $matches.Groups [1 ].Value
35
+ Write-Output " Found: $prevousVersion "
36
+
37
+ $content = $content.Replace (" <?define productName=`" Microsoft Azure PowerShell - $prevousVersion `" ?>" , " <?define productName=`" Microsoft Azure PowerShell - $MsiRelease `" ?>" )
38
+
39
+ Set-Content - Path $wxsPath - Value $content - Encoding UTF8
40
+ }
41
+
42
+ if (! $Folder )
43
+ {
44
+ $Folder = " $PSScriptRoot \..\setup"
45
+ }
46
+
47
+ SetMsiVersion $Folder $Version
48
+ SetMsiReleaseString $Folder $Release
0 commit comments