Created
February 12, 2016 15:58
-
-
Save swade1987/5436443d5193b981311d to your computer and use it in GitHub Desktop.
assembly
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
#------------------------------------------------------------------------------- | |
# Update version numbers of AssemblyInfo.cs | |
#------------------------------------------------------------------------------- | |
function Update-AssemblyInfoFiles ([string] $version) { | |
$assemblyVersionPattern = 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)' | |
$fileVersionPattern = 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)' | |
$assemblyVersion = 'AssemblyVersion("' + $version + '")'; | |
$fileVersion = 'AssemblyFileVersion("' + $version + '")'; | |
Get-ChildItem -r -filter AssemblyInfo.cs | ForEach-Object { | |
$filename = $_.Directory.ToString() + '\' + $_.Name | |
$filename + ' -> ' + $version | |
# If you are using a source control that requires to check-out files before | |
# modifying them, make sure to check-out the file here. | |
# For example, TFS will require the following command: | |
# tf checkout $filename | |
(Get-Content $filename) | ForEach-Object { | |
% {$_ -replace $assemblyVersionPattern, $assemblyVersion } | | |
% {$_ -replace $fileVersionPattern, $fileVersion } | |
} | Set-Content $filename | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment