-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-version.ps1
More file actions
27 lines (23 loc) · 953 Bytes
/
update-version.ps1
File metadata and controls
27 lines (23 loc) · 953 Bytes
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
if ($env:VERSION_BUILD_NUMBER) {
$manifestPaths = @(
".\ContextMenuBuilder\Package.appxmanifest"
)
foreach ($manifestPath in $manifestPaths) {
if (-not (Test-Path -LiteralPath $manifestPath)) {
Write-Warning "Manifest not found: $manifestPath"
continue
}
$appxManifestPath = Convert-Path $manifestPath
[xml]$manifest = Get-Content -Path $appxManifestPath
$version = $manifest.Package.Identity.Version
$versionParts = $version -split '\.'
if ($versionParts.Length -ne 4) {
Write-Error "Version format error: $version ($appxManifestPath)"
exit 1
}
$versionParts[3] = $env:VERSION_BUILD_NUMBER
$manifest.Package.Identity.Version = $versionParts -join "."
Write-Host "package new version ($appxManifestPath): $($manifest.Package.Identity.Version)"
$manifest.Save($appxManifestPath)
}
}