forked from microsoft/WindowsAppSDK-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateVersions.ps1
39 lines (35 loc) · 1.88 KB
/
UpdateVersions.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
Param(
[string]$WinAppSDKVersion = ""
)
Get-ChildItem -Recurse packages.config -Path $PSScriptRoot | foreach-object {
$newVersionString = 'package id="Microsoft.WindowsAppSDK" version="' + $WinAppSDKVersion + '"'
$oldVersionString = 'package id="Microsoft.WindowsAppSDK" version="[-.0-9a-zA-Z]*"'
$content = Get-Content $_.FullName -Raw
$content = $content -replace $oldVersionString, $newVersionString
Set-Content -Path $_.FullName -Value $content
Write-Host "Modified " $_.FullName
}
Get-ChildItem -Recurse *.vcxproj -Path $PSScriptRoot | foreach-object {
$newVersionString = '\Microsoft.WindowsAppSDK.' + $WinAppSDKVersion + '\'
$oldVersionString = '\\Microsoft.WindowsAppSDK.[-.0-9a-zA-Z]*\\'
$content = Get-Content $_.FullName -Raw
$content = $content -replace $oldVersionString, $newVersionString
Set-Content -Path $_.FullName -Value $content
Write-Host "Modified " $_.FullName
}
Get-ChildItem -Recurse *.wapproj -Path $PSScriptRoot | foreach-object {
$newVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersion + '"'
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="[-.0-9a-zA-Z]*"'
$content = Get-Content $_.FullName -Raw
$content = $content -replace $oldVersionString, $newVersionString
Set-Content -Path $_.FullName -Value $content
Write-Host "Modified " $_.FullName
}
Get-ChildItem -Recurse *.csproj -Path $PSScriptRoot | foreach-object {
$newVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersion + '"'
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="[-.0-9a-zA-Z]*"'
$content = Get-Content $_.FullName -Raw
$content = $content -replace $oldVersionString, $newVersionString
Set-Content -Path $_.FullName -Value $content
Write-Host "Modified " $_.FullName
}