Created
March 4, 2018 15:41
-
-
Save MarcusFelling/97a7b9a70685080bfe490f46df5cd02a to your computer and use it in GitHub Desktop.
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
$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