Last active
August 29, 2015 14:17
-
-
Save adamwitko/2049099b65fdf7670171 to your computer and use it in GitHub Desktop.
Powershell AssemblyInfo patcher example
This file contains hidden or 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
$Version = "5.1.2" | |
$NewVersion = 'AssemblyVersion("' + $Version + '")'; | |
$NewFileVersion = 'AssemblyFileVersion("' + $Version + '")'; | |
Get-ChildItem .\ -Recurse -Filter AssemblyInfo.cs | % ` | |
{ | |
$FilePath = $_.FullName; | |
$TmpFile = $filePath + ".tmp" | |
Get-Content $FilePath | | |
% { $_ -replace 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', $NewVersion } | | |
% { $_ -replace 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', $NewFileVersion } > $TmpFile | |
Move-Item $TmpFile $FilePath -Force | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment