Skip to content

Instantly share code, notes, and snippets.

@Pliner
Last active August 29, 2015 14:19
Show Gist options
  • Save Pliner/ae1288a90fbb63d72fa8 to your computer and use it in GitHub Desktop.
Save Pliner/ae1288a90fbb63d72fa8 to your computer and use it in GitHub Desktop.
function Patch-Version($pathToFile, $buildNumber) {
$versionFormat = "(\d+)\.(\d+)\.(\d+)\.(\d+)";
$pathToTmpFile = $pathToFile + ".tmp";
Get-Content $pathToFile | % { $_ -replace $versionFormat, ('$1.$2.' + $buildNumber + '.$4') } | Set-Content $pathToTmpFile
Move-Item $pathToTmpFile $pathToFile -force
}
Patch-Version $args[0] $args[1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment