Skip to content

Instantly share code, notes, and snippets.

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 ykurniawan/64e374b9a11dc34e39ae5ba136adbb67 to your computer and use it in GitHub Desktop.
Save ykurniawan/64e374b9a11dc34e39ae5ba136adbb67 to your computer and use it in GitHub Desktop.
Powershell Script to Update Android Version Code during VSTS Build
$ManifestFile = Get-ChildItem -Path $Env:BUILD_SOURCESDIRECTORY -Filter AndroidManifest.xml -Recurse
$fileXml = [xml] (Get-Content $ManifestFile.FullName )
$xpath = "//manifest"
Select-Xml -xml $fileXml -XPath $xpath | %{
$_.Node.SetAttribute("android:versionName", "1.0.0.$Env:BUILD_BUILDNUMBER")
$_.Node.SetAttribute("android:versionCode", $Env:BUILD_BUILDNUMBER)
}
$fileXml.Save($ManifestFile)
Get-Content $ManifestFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment