Created
November 13, 2015 13:47
-
-
Save Gimly/9f00a1adb03272b11d6e to your computer and use it in GitHub Desktop.
This file contains 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
# Use a regular expression to get "minor, major, fix, revision" from the BUILD_BUILDNUMBER environment variable | |
# the build process will automatically set the value of the environment variable to the correct build number | |
$VersionRegex = "\d+\.\d+\.\d+\.\d+" | |
$NewVersion = [regex]::matches($Env:BUILD_BUILDNUMBER,$VersionRegex) | |
Write-Host "Updating version of the application to the build version: " $NewVersion | |
$file = ".\SharedAssemblyInfo.cs" | |
$filecontent = Get-Content($file) | |
attrib $file -r | |
# Search in the "SharedAssemblyInfo.cs" file items that matches the version regex and replace them with the | |
# correct version number | |
$filecontent -replace $VersionRegex, $NewVersion | Out-File $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment