Created
January 11, 2019 10:06
-
-
Save johnmmoss/903ad14759b9972f4f5f5a5ce4e37367 to your computer and use it in GitHub Desktop.
Using Powershell to set the BuildNumber in a json file
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
Get-ChildItem configs -Filter appConfig*.json | % { | |
$fullName = $_.FullName | |
write-output "Applying build number to $fileName" | |
$fileContent = Get-Content $fullName | |
$replacedFileContent = $fileContent.replace('BUILDNUMBER', $(Build.BuildNumber)) | |
Set-Content -Path $fullName -Value $replacedFileContent | |
write-output "COMPLETED Applying build number to $fileName" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment