Skip to content

Instantly share code, notes, and snippets.

@nvnivs
Last active August 29, 2015 13:57
Show Gist options
  • Save nvnivs/9782601 to your computer and use it in GitHub Desktop.
Save nvnivs/9782601 to your computer and use it in GitHub Desktop.
Recursivelly updates the version of AssemblyInfo.cs files
<#
.Synopsis
Recursively updates the version of AssemblyInfo.cs files
.Parameter baseDir
The root directory from which to recursively search for AssemblyInfo files
Defaults to the directory of the script.
.Link
https://gist.github.com/z0c
#>
param(
[string] $baseDir = (Resolve-Path .),
[Parameter(Mandatory = $true)] [string] $version
)
(Get-ChildItem -Path $baseDir -Filter AssemblyInfo.cs -Recurse) |
Foreach-Object {
(Get-Content $_.FullName) |
Foreach-Object {
$_ -replace 'AssemblyVersion.+$',"AssemblyVersion(`"$version`")]" `
-replace 'AssemblyFileVersion.+$',"AssemblyFileVersion(`"$version`")]"
} |
Out-File $_.FullName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment