File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<Project Sdk =" WixToolset.Sdk/4.0.5" >
22 <PropertyGroup >
3- $11 .0.3</Version >
3+ < Version Condition = " '$(Version)' == '' " >1 .0.3</Version >
44 <OutputName >GhostDrawSetup-$(Version)</OutputName >
55 <OutputType >Package</OutputType >
66 <Platform >x64</Platform >
Original file line number Diff line number Diff line change @@ -255,10 +255,10 @@ function Update-WixVersion {
255255
256256 $content = Get-Content $FilePath - Raw
257257 # Match: <Version Condition="'$(Version)' == ''">X.Y.Z</Version>
258- $pattern = " ( <Version\s+Condition=`" '\ ` $ \(Version\)'\s*==\s*''`" >) ([^<]*)( </Version>) "
258+ $pattern = ' <Version\s+Condition=" '' \ $\(Version\)'' \s*==\s*'''' "> ([^<]*)</Version>'
259259
260260 if ($content -match $pattern ) {
261- $currentVersion = [regex ]::Match($content , $pattern ).Groups[2 ].Value
261+ $currentVersion = [regex ]::Match($content , $pattern ).Groups[1 ].Value
262262
263263 if ($currentVersion -eq $NewVersion ) {
264264 Write-Host " Already at version $NewVersion " - ForegroundColor Gray
@@ -268,7 +268,8 @@ function Update-WixVersion {
268268 if ($DryRun ) {
269269 Write-Host " [DRY-RUN] Would update: $currentVersion -> $NewVersion " - ForegroundColor Cyan
270270 } else {
271- $newContent = $content -replace $pattern , " `$ 1$NewVersion `$ 3"
271+ $replacement = " <Version Condition=`" '`$ (Version)' == ''`" >$NewVersion </Version>"
272+ $newContent = $content -replace $pattern , $replacement
272273 Set-Content $FilePath - Value $newContent - NoNewline
273274 Write-Host " Updated: $currentVersion -> $NewVersion " - ForegroundColor Green
274275 }
You can’t perform that action at this time.
0 commit comments