Skip to content

Commit b5c510e

Browse files
authored
Fix UpdateVersions.ps1 to accomodate that samples can be on different versions. (#250)
1 parent a3ef45b commit b5c510e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

UpdateVersions.ps1

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
Param(
2-
[string]$WinAppSDKVersion = "",
3-
[string]$WinAppSDKVersionOld = "1.0.0"
2+
[string]$WinAppSDKVersion = ""
43
)
54

65
Get-ChildItem -Recurse packages.config -Path $PSScriptRoot | foreach-object {
76
$newVersionString = 'package id="Microsoft.WindowsAppSDK" version="' + $WinAppSDKVersion + '"'
8-
$oldVersionString = 'package id="Microsoft.WindowsAppSDK" version="' + $WinAppSDKVersionOld + '"'
7+
$oldVersionString = 'package id="Microsoft.WindowsAppSDK" version="[-.0-9a-zA-Z]*"'
98
$content = Get-Content $_.FullName -Raw
10-
$content = $content.replace($oldVersionString, $newVersionString)
9+
$content = $content -replace $oldVersionString, $newVersionString
1110
Set-Content -Path $_.FullName -Value $content
1211
Write-Host "Modified " $_.FullName
1312
}
1413

1514
Get-ChildItem -Recurse *.vcxproj -Path $PSScriptRoot | foreach-object {
16-
$newVersionString = 'packages\Microsoft.WindowsAppSDK.' + $WinAppSDKVersion
17-
$oldVersionString = 'packages\Microsoft.WindowsAppSDK.' + $WinAppSDKVersionOld
15+
$newVersionString = 'packages\Microsoft.WindowsAppSDK.' + $WinAppSDKVersion + '\'
16+
$oldVersionString = 'packages\\Microsoft.WindowsAppSDK.[-.0-9a-zA-Z]*\\'
1817
$content = Get-Content $_.FullName -Raw
19-
$content = $content.replace($oldVersionString, $newVersionString)
18+
$content = $content -replace $oldVersionString, $newVersionString
2019
Set-Content -Path $_.FullName -Value $content
2120
Write-Host "Modified " $_.FullName
2221
}
2322

2423
Get-ChildItem -Recurse *.wapproj -Path $PSScriptRoot | foreach-object {
2524
$newVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersion + '"'
26-
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersionOld + '"'
25+
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="[-.0-9a-zA-Z]*"'
2726
$content = Get-Content $_.FullName -Raw
28-
$content = $content.replace($oldVersionString, $newVersionString)
27+
$content = $content -replace $oldVersionString, $newVersionString
2928
Set-Content -Path $_.FullName -Value $content
3029
Write-Host "Modified " $_.FullName
3130
}
3231

3332
Get-ChildItem -Recurse *.csproj -Path $PSScriptRoot | foreach-object {
3433
$newVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersion + '"'
35-
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="'+ $WinAppSDKVersionOld + '"'
34+
$oldVersionString = 'PackageReference Include="Microsoft.WindowsAppSDK" Version="[-.0-9a-zA-Z]*"'
3635
$content = Get-Content $_.FullName -Raw
37-
$content = $content.replace($oldVersionString, $newVersionString)
36+
$content = $content -replace $oldVersionString, $newVersionString
3837
Set-Content -Path $_.FullName -Value $content
3938
Write-Host "Modified " $_.FullName
4039
}

0 commit comments

Comments
 (0)