@@ -99,33 +99,29 @@ jobs:
99
99
shell : pwsh
100
100
run : |
101
101
$proj = 'UnityLauncherProInstaller\UnityLauncherProInstaller.vdproj'
102
- $ver = '${{ env.INSTALLER_VER }}' # e.g. "0.0.117"
103
- $guid = [Guid]::NewGuid().ToString("B").ToUpper() # e.g. "{1D05663F-...}"
104
-
105
- # Load entire file
106
- $content = Get-Content $proj -Raw
107
-
108
- # Build the literal replacement strings
109
- $replacementVer = '$1' + $ver + '"' # yields: $1<version>"
110
- $replacementCode = '$1{' + $guid + '}' # yields: $1{<GUID>}
102
+ $ver = "${{ env.INSTALLER_VER }}" # e.g. 0.0.118
103
+ $guid = [Guid]::NewGuid().ToString("B").ToUpper() # e.g. {E821A3F5-1F84-4A4B-BE9D-115D93E9E6F0}
104
+
105
+ # Read & rewrite line-by-line
106
+ $fixed = Get-Content $proj | ForEach-Object {
107
+ if ($_ -match '^(\s*)"ProductVersion"') {
108
+ # preserve indentation, then inject exactly one pair of braces
109
+ "$($Matches[1])""ProductVersion"" = ""8:$ver"""
110
+ }
111
+ elseif ($_ -match '^(\s*)"ProductCode"') {
112
+ "$($Matches[1])""ProductCode"" = ""8:$guid"""
113
+ }
114
+ else {
115
+ $_
116
+ }
117
+ }
111
118
112
- # Do the replacements
113
- $content = [regex]::Replace(
114
- $content,
115
- '("ProductVersion"\s*=\s*"8:)[^"]+"',
116
- $replacementVer
117
- )
118
- $content = [regex]::Replace(
119
- $content,
120
- '("ProductCode"\s*=\s*"8:)\{[^}]+\}"',
121
- $replacementCode
122
- )
119
+ # Overwrite the project
120
+ Set-Content -Path $proj -Value $fixed
123
121
124
- # Overwrite the file
125
- Set-Content -Path $proj -Value $content
122
+ Write-Host "→ ProductVersion patched to 8:$ver"
123
+ Write-Host "→ ProductCode patched to 8:$guid"
126
124
127
- Write-Host "→ ProductVersion patched to $ver"
128
- Write-Host "→ ProductCode patched to $guid"
129
125
130
126
# 3) **DEBUG**: print out the patched .vdproj so you can inspect it
131
127
- name : Show patched .vdproj
0 commit comments