Skip to content

Instantly share code, notes, and snippets.

@Eonasdan
Created December 21, 2021 14:43
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 Eonasdan/fce300ce9ac646648ed6b48ba3e6f30e to your computer and use it in GitHub Desktop.
Save Eonasdan/fce300ce9ac646648ed6b48ba3e6f30e to your computer and use it in GitHub Desktop.
This powershell script can be used as an Azure DevOps task to take the build number and update appsettings or other json file as a version
$config = Get-Content "[path_to]\appsettings.json" -Raw|ConvertFrom-Json
Write-Host Current Server Version: $mainServerConfig.Version
$config.version = $Env:BUILD_BUILDNUMBER;
$config|ConvertTo-Json |Set-Content "[path_to]\appsettings.json"
Write-Host Updated Version: $Env:BUILD_BUILDNUMBER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment