Skip to content

Instantly share code, notes, and snippets.

@MarcusFelling
Created March 4, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcusFelling/97a7b9a70685080bfe490f46df5cd02a to your computer and use it in GitHub Desktop.
Save MarcusFelling/97a7b9a70685080bfe490f46df5cd02a to your computer and use it in GitHub Desktop.
$VersionRegex = "\d+\.\d+\.\d+\.\d+"
$Files = Get-ChildItem $Env:BUILD_SOURCESDIRECTORY -recurse -include "*Properties*" |
?{ $_.PSIsContainer } |
ForEach { Get-ChildItem -Path $_.FullName -Recurse -include AssemblyInfo.* }
If($Files){
"Will apply $env:Version to $($Files.count) files."
ForEach ($File in $Files) {
$Filecontent = Get-Content($File)
attrib $File -r
$Filecontent -replace $VersionRegex, $env:Version | Out-File $File
"$File - version applied"
}
}
Else{
Write-Warning "Found no files."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment