Build scripts

You can add up to three custom build steps that run at pre-defined stages during build time: post-clone, pre-build, post-build. Place the scripts with the format specified below next to the project-level (.xcodeproj, .csproj, .sln or package.json) file or module-level (build.gradle) file that you've selected in the build configuration and we will run them as custom build steps. For iOS and Android apps, we support Bash scripts, for UWP apps we support PowerShell scripts. If one of your scripts is failing, the whole build will fail. This way we ensure it won’t fail at a later time and therefore saves you build time.

You can find a collection of build script examples on the dedicated public GitHub repository. We welcome contributions and suggestions - feel free to use the sample scripts, to modify them or to submit new pull requests with your most useful scripts, for the rest of the community to use them.

When App Center detects build scripts for the first time, or whenever you make changes to the location of scripts or, for iOS projects, where you store CocoaPods, you must click the Save or Save & Build button in the build configuration to apply the changes. When you do this, App Center performs an analysis to index your repository tree and updates the build definition.


Every time you modify the project's build scripts, you must click the Save or Save & Build button to save the branch configuration to apply the changes.

Save detected scripts


The post-clone script runs immediately after the repository was cloned but before we do anything else on our end.

To run scripts post-clone, add the following file next to the project file in your repository:

  • (Bash for iOS & Android)

    #!/usr/bin/env bash
    # Example: Clone a required repository
    git clone
    # Example: Install App Center CLI
    npm install -g appcenter-cli
  • appcenter-post-clone.ps1 (PowerShell for UWP)


The pre-build script runs before the actual build starts. For React Native apps, the script runs before generating source maps. For other platforms, it runs after we have installed dependencies from e.g. NuGet, CocoaPods or Carthage.

To run scripts pre-build, add the following file next to the project file in your repository:

  • (Bash for iOS & Android)

    #!/usr/bin/env bash
    # Example: Change bundle name of an iOS app for non-production
    if [ "$APPCENTER_BRANCH" != "master" ];
        plutil -replace CFBundleName -string "\$(PRODUCT_NAME) Beta" $APPCENTER_SOURCE_DIRECTORY/MyApp/Info.plist
  • appcenter-pre-build.ps1 (PowerShell for UWP)


The post-build script runs after the build has finished and we have copied all the necessary artifacts to the output directory. Note that the post-build script will run even if the build fails.

To run scripts post-build, add the following file next to the project file in the repository:

  • (Bash for iOS & Android)

    if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then
        # Example: Upload master branch app binary to HockeyApp using the API
        if [ "$APPCENTER_BRANCH" == "master" ];
            curl \
            -F "status=2" \
            -F "ipa=@$APPCENTER_OUTPUT_DIRECTORY/MyApps.ipa" \
            -H "X-HockeyAppToken: $HOCKEYAPP_API_TOKEN" \
            echo "Current branch is $APPCENTER_BRANCH"
  • appcenter-post-build.ps1 (PowerShell for UWP)

App Center variables

We set the following environment variables, so you can access them from your build scripts.

General variables Description
APPCENTER_BUILD_ID The unique identifier for the current build
APPCENTER_BRANCH Name of the branch that is being built from
APPCENTER_SOURCE_DIRECTORY Location of the source code on the build machine
APPCENTER_OUTPUT_DIRECTORY Location where the build results are stored in
APPCENTER_TRIGGER What triggered the build, was it manual or continuous by push

iOS specific
APPCENTER_XCODE_PROJECT Selected Xcode project
APPCENTER_XCODE_SCHEME Selected Xcode scheme

Android specific
APPCENTER_ANDROID_VARIANT Selected Android variant
APPCENTER_ANDROID_MODULE Selected Android module

UWP specific

Xamarin specific

React Native specific