Created
July 6, 2012 16:44
-
-
Save edwinf/3061260 to your computer and use it in GitHub Desktop.
update guid attribute on an assemblyinfo.cs file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($args.Length -eq 1) | |
{ | |
if (Test-Path $args[0]) | |
{ | |
$tempFile = $args[0]+".tmp"; | |
Write-Host "Getting content from: "$args[0]; | |
Write-Host "Writing to temp file: " $tempFile; | |
$newGuid = [System.Guid]::NewGuid().Guid; | |
$newGuid = "Guid(""" + $newGuid + """)"; | |
Write-Host "Replacing with: " $newGuid; | |
Get-Content $args[0] | | |
%{$_ -replace 'Guid\(([^\)]+)\)',$newGuid} > $tempFile | |
move-item $tempFile $args[0] -force; | |
}else{ | |
Write-Host "File Not Found"; | |
} | |
}else{ | |
Write-Host "Provide file path as argument"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment