forked from FlaUI/FlaUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdjustConfig.ps1
28 lines (22 loc) · 987 Bytes
/
AdjustConfig.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
$newVersion = "1.2.0"
$suffix = ""
function Main() {
ReplaceVersion
}
function ReplaceVersion {
RegexReplaceTextInFile "CreateArtefacts.ps1" "(?<=\`$version = `").*?(?=`")" "$($newVersion)$($suffix)"
ReplaceAssemblyVersion "src\FlaUI.Core\Properties\AssemblyInfo.cs"
ReplaceAssemblyVersion "src\FlaUI.UIA2\Properties\AssemblyInfo.cs"
ReplaceAssemblyVersion "src\FlaUI.UIA3\Properties\AssemblyInfo.cs"
}
function ReplaceAssemblyVersion($assemblyFile) {
RegexReplaceTextInFile $assemblyFile "(?<=AssemblyVersion\(`").*?(?=`"\))" $newVersion
RegexReplaceTextInFile $assemblyFile "(?<=AssemblyFileVersion\(`").*?(?=`"\))" $newVersion
RegexReplaceTextInFile $assemblyFile "(?<=AssemblyInformationalVersion\(`").*?(?=`"\))" "$($newVersion)$($suffix)"
}
function RegexReplaceTextInFile($file, $from, $to) {
$content = [System.IO.File]::ReadAllText($file)
$content = $content -replace $from, $to
[System.IO.File]::WriteAllText($file, $content)
}
Main