File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -99,18 +99,33 @@ jobs:
9999 shell : pwsh
100100 run : |
101101 $proj = 'UnityLauncherProInstaller\UnityLauncherProInstaller.vdproj'
102- $ver = " ${{ env.INSTALLER_VER }}"
103- $guid = [guid ]::NewGuid().ToString("B").ToUpper()
102+ $ver = ' ${{ env.INSTALLER_VER }}' # e.g. "0.0.117 "
103+ $guid = [Guid ]::NewGuid().ToString("B").ToUpper() # e.g. "{1D05663F-...}"
104104
105- (Get-Content $proj) |
106- ForEach-Object {
107- $_ -replace '("ProductVersion"\s*=\s*"8:)[^"]+"', "`$1$ver`"" `
108- -replace '("ProductCode"\s*=\s*"8:)\{[^}]+\}"', "`$1{$guid}`""
109- } |
110- Set-Content $proj
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>}
111+
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+ )
123+
124+ # Overwrite the file
125+ Set-Content -Path $proj -Value $content
111126
112127 Write-Host "→ ProductVersion patched to $ver"
113- Write-Host "→ ProductCode patched to $guid"
128+ Write-Host "→ ProductCode patched to $guid"
114129
115130 # 3) **DEBUG**: print out the patched .vdproj so you can inspect it
116131 - name : Show patched .vdproj
You can’t perform that action at this time.
0 commit comments