Skip to content

Instantly share code, notes, and snippets.

@andykuszyk
Last active June 10, 2016 09:06
Show Gist options
  • Save andykuszyk/a30e0c1e5d493549a21b2cfc8aa3b07c to your computer and use it in GitHub Desktop.
Save andykuszyk/a30e0c1e5d493549a21b2cfc8aa3b07c to your computer and use it in GitHub Desktop.
Replace version numbers in assembly info files
# This powershell script is aimed at batch replacing version numbers
# in assembly info files. Provide the old version number that needs replacing
# and the new version number to replace it with. Run the script
# in the solution directory (e.g. the one that contains [ProjectName]\properties folders)
Param([string]$oldVersion, [string]$newVersion)
foreach($folder in Get-ChildItem -dir) {
$assemblyInfoPath = "$folder\properties\AssemblyInfo.cs"
Write-Host "Assembly info path: $assemblyInfoPath"
if(Test-Path $assemblyInfoPath) {
Write-Host "Assembly info found"
(Get-Content $assemblyInfoPath -encoding UTF8) | foreach-object {
$_ -replace $oldVersion, $newVersion
} | Set-Content $assemblyInfoPath -encoding UTF8
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment