Skip to content

Instantly share code, notes, and snippets.

@xleon
Last active February 20, 2016 13:33
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 xleon/9b3a8750b9cf55e30893 to your computer and use it in GitHub Desktop.
Save xleon/9b3a8750b9cf55e30893 to your computer and use it in GitHub Desktop.
PowerShell script to update iOS bundle (Info.pslist) depending on the build configuration. This way you can target different identifiers/display names and have them all installed in the same device
PowerShell -File "$(ProjectDir)Update-Bundle.ps1" $(ProjectDir) $(ConfigurationName)
param ([string] $ProjectDir, [string] $ConfigurationName)
Write-Host "ProjectDir: $ProjectDir"
Write-Host "ConfigurationName: $ConfigurationName"
$PlistPath = $ProjectDir + "Info.plist"
Write-Host "PlistPath: $PlistPath"
[xml] $xdoc = Get-Content $PlistPath
$displayName = $xdoc.plist.dict.ChildNodes[1].'#text'
$identifier = $xdoc.plist.dict.ChildNodes[3].'#text'
Write-Host "Current displayName: $displayName"
Write-Host "Current identifier: $identifier"
If ($ConfigurationName -eq "Debug")
{
$xdoc.plist.dict.ChildNodes[1].'#text' = "AppNameDev"
$xdoc.plist.dict.ChildNodes[3].'#text' = "com.namespace.appname.dev"
$xdoc.Save($PlistPath)
}
If ($ConfigurationName -eq "Ad-Hoc")
{
$xdoc.plist.dict.ChildNodes[1].'#text' = "AppNameSta"
$xdoc.plist.dict.ChildNodes[3].'#text' = "com.namespace.appname.staging"
$xdoc.Save($PlistPath)
}
If ($ConfigurationName -eq "AppStore")
{
$xdoc.plist.dict.ChildNodes[1].'#text' = "AppName"
$xdoc.plist.dict.ChildNodes[3].'#text' = "com.namespace.appname"
$xdoc.Save($PlistPath)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment