Last active
June 10, 2016 09:06
-
-
Save andykuszyk/a30e0c1e5d493549a21b2cfc8aa3b07c to your computer and use it in GitHub Desktop.
Replace version numbers in assembly info files
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
# 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