Skip to content

Instantly share code, notes, and snippets.

@altu
altu / gist:0ba467c4f42e19645e8e
Created June 25, 2015 12:54
PowerShell function for updating the VDProj's version information
function Update-vdproj-version([version] $ver, [string] $filename) {
$productCodePattern = '\"ProductCode\" = \"8\:{([\d\w-]+)}\"'
$packageCodePattern = '\"PackageCode\" = \"8\:{([\d\w-]+)}\"'
$productVersionPattern = '\"ProductVersion\" = \"8\:[0-9]+(\.([0-9]+)){1,3}\"'
$productCode = '"ProductCode" = "8:{' + [guid]::NewGuid().ToString().ToUpper() + '}"'
$packageCode = '"PackageCode" = "8:{' + [guid]::NewGuid().ToString().ToUpper() + '}"'
$productVersion = '"ProductVersion" = "8:' + $ver.ToString(3) + '"'
(Get-Content $filename) | ForEach-Object {
% {$_ -replace $productCodePattern, $productCode } |