Public/DotNet/Update-AssemblyInfoBuild.ps1
function Update-AssemblyInfoBuild($path) { if (!$path) { $path = get-location } Get-ChildItem -path $path -filter "*AssemblyInfo.cs" -Recurse|ForEach-Object { $c = Get-Content $_.FullName $value = [System.text.RegularExpressions.Regex]::Match($c, "[\d]{1,2}\.[\d]{1}\.[\d]*(\.[\d]*)?").Value $version = New-Object System.Version ($value) $newBuild = $version.Build + 1 $newVersion = new-object System.Version ($version.Major, $version.Minor, $newBuild, 0) "$_ new version is $newVersion " $result = $c -creplace 'Version\("([^"]*)', "Version(""$newVersion" Set-Content $_.FullName $result } } |