Skip to content

Instantly share code, notes, and snippets.

@xleon
Last active February 20, 2016 13:33
Show Gist options
  • Select an option

  • Save xleon/9b3a8750b9cf55e30893 to your computer and use it in GitHub Desktop.

Select an option

Save xleon/9b3a8750b9cf55e30893 to your computer and use it in GitHub Desktop.

Revisions

  1. Diego Ponce de León revised this gist Feb 20, 2016. No changes.
  2. Diego Ponce de León created this gist Feb 20, 2016.
    1 change: 1 addition & 0 deletions Pre-build event (Visual Studio)
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    PowerShell -File "$(ProjectDir)Update-Bundle.ps1" $(ProjectDir) $(ConfigurationName)
    34 changes: 34 additions & 0 deletions Update-Bundle.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    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)
    }