-
Notifications
You must be signed in to change notification settings - Fork 3
/
set_version_metadata.ps1
39 lines (30 loc) · 1.07 KB
/
set_version_metadata.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
# PowerShell Cinegy Build Script
# COPYRIGHT Cinegy 2020-2022
param([string]$softwareVersion)
$SoftwareVersion = $softwareVersion
Get-ChildItem -Path *.csproj -Recurse | ForEach-Object {
$fileName = $_
Write-Host "Processing metadata changes for file: $fileName"
[xml]$projectXml = Get-Content -Path $fileName
$nodes = $projectXml.SelectNodes("/Project/PropertyGroup/Copyright")
foreach($node in $nodes) {
$node.'#text' = "$([char]0xA9)$((Get-Date).year) Cinegy. All rights reserved."
}
$nodes = $projectXml.SelectNodes("/Project/PropertyGroup/Description")
foreach($node in $nodes) {
$node.'#text' = "$($node.'#text')."
}
$nodes = $projectXml.SelectNodes("/Project/PropertyGroup/Version")
foreach($node in $nodes) {
$node.'#text' = $SoftwareVersion
}
$nodes = $projectXml.SelectNodes("/Project/PropertyGroup/AssemblyVersion")
foreach($node in $nodes) {
$node.'#text' = $SoftwareVersion
}
$nodes = $projectXml.SelectNodes("/Project/PropertyGroup/FileVersion")
foreach($node in $nodes) {
$node.'#text' = $SoftwareVersion
}
$projectXml.Save($fileName)
}