Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created January 11, 2019 10:06
Show Gist options
  • Save johnmmoss/903ad14759b9972f4f5f5a5ce4e37367 to your computer and use it in GitHub Desktop.
Save johnmmoss/903ad14759b9972f4f5f5a5ce4e37367 to your computer and use it in GitHub Desktop.
Using Powershell to set the BuildNumber in a json file
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