# PBXProject

> Represents an Xcode project (pbxproj file).

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.iOS.Xcode](/engine/6000.5/script-reference/unityeditor/ios/xcode.md)
* **Assembly:** UnityEditor.iOS.Extensions.Xcode

```csharp
public class PBXProject
```

## Examples

```csharp
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public class Sample_PBXProject  
{
    [PostProcessBuild]
    public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject)
    {
        // Stop processing if build target is not iOS
        if (buildTarget != BuildTarget.iOS)
            return;

        // Initialize PBXProject
        string projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
        PBXProject pbxProject = new PBXProject();
        pbxProject.ReadFromFile(projectPath);

        // Perform any modifications you want to the PBXProject

        // Get the target GUID
        string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();

        // Add a new build configuration and add a new property to it
        string configName = "exampleConfig";
        pbxProject.AddBuildConfig(configName);
        string configGuid = pbxProject.BuildConfigByName(mainTargetGuid, configName);
        pbxProject.AddBuildPropertyForConfig(configGuid, "exampleProperty", "exampleValue");

        // Add a new file to project and to build list
        string filePath = Path.Combine(Application.dataPath, "Resources/InputFile.txt");
        string fileGuid = pbxProject.AddFile(filePath, "Resources/InputFile.txt");
        pbxProject.AddFileToBuild(mainTargetGuid, fileGuid);

        // Add frameworks to the project
        pbxProject.AddFrameworkToProject(mainTargetGuid, "CoreBluetooth.framework", false);
        pbxProject.AddFrameworkToProject(mainTargetGuid, "MapKit.framework", true);

        // Apply changes to the pbxproj file
        pbxProject.WriteToFile(projectPath);
    }

}
```

## Constructors

| Constructor                                                                              | Description                                 |
| ---------------------------------------------------------------------------------------- | ------------------------------------------- |
| [PBXProject()](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/ctor.md) | Creates a new instance of PBXProject class. |

## Properties

| Property                                                                                                                                                   | Description                                                                                                       |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [unityPostprocessTargetPhonyBuildPhaseName](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/unitypostprocesstargetphonybuildphasename.md) | The name of the placeholder build phase, which Unity adds to indicate a place to add **post-processing** actions. |

## Methods

| Method                                                                                                                                                                 | Description                                                                                                                                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [AddAssetTagForFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addassettagforfile.md)                                                           | Adds an asset tag for the given file.                                                                                                                                          |
| [AddAssetTagToDefaultInstall](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addassettagtodefaultinstall.md)                                         | Adds the asset tag to the list of tags to download during initial installation.                                                                                                |
| [AddBuildConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addbuildconfig.md)                                                                   | Creates a new set of build configurations for all targets in the project.                                                                                                      |
| [AddBuildProperty](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addbuildproperty.md)                                                               | Adds a value to the build property list in all the build configurations for the specified target(s).                                                                           |
| [AddBuildPropertyForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addbuildpropertyforconfig.md)                                             | Adds a value to build property list of the given build configuration(s).                                                                                                       |
| [AddCapability](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addcapability.md)                                                                     | Adds a target capability to the Xcode project.                                                                                                                                 |
| [AddCopyFilesBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addcopyfilesbuildphase.md)                                                   | Creates a new **Copy Files** build phase for a given target.                                                                                                                   |
| [AddCopyFilesBuildPhaseBeforeTargetPostprocess](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addcopyfilesbuildphasebeforetargetpostprocess.md)     | Creates a new **Copy Files** build phase for a given target.                                                                                                                   |
| [AddFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfile.md)                                                                                 | Adds a new file reference to the list of known files.                                                                                                                          |
| [AddFileToBuild](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfiletobuild.md)                                                                   | Configure a file to build for the given native target.                                                                                                                         |
| [AddFileToBuildSection](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfiletobuildsection.md)                                                     | Configures file for building for the given native target on specific build section.                                                                                            |
| [AddFileToBuildWithFlags](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfiletobuildwithflags.md)                                                 | Configure a file for building for the given target with specific compiler flags.                                                                                               |
| [AddFolderReference](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfolderreference.md)                                                           | Adds a new folder reference to the list of known files.                                                                                                                        |
| [AddFrameworksBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addframeworksbuildphase.md)                                                 | Creates a new frameworks build phase for given target.                                                                                                                         |
| [AddFrameworkToProject](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addframeworktoproject.md)                                                     | Adds a system framework dependency for the specified target.                                                                                                                   |
| [AddHeadersBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addheadersbuildphase.md)                                                       | Creates a new headers build phase for a given target.                                                                                                                          |
| [AddKnownRegion](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addknownregion.md)                                                                   | Adds the provided regions to the Xcode Project.                                                                                                                                |
| [AddLocaleVariantFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addlocalevariantfile.md)                                                       | Adds Locale to Variant Group of Xcode Project for iOS platform.                                                                                                                |
| [AddPublicHeaderToBuild](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addpublicheadertobuild.md)                                                   | Configures a file for building for the given native target as a public header.                                                                                                 |
| [AddRemotePackageFrameworkToProject](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackageframeworktoproject.md)                           | Adds a remote package framework dependency for the specified target.                                                                                                           |
| [AddRemotePackageReferenceAtBranch](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferenceatbranch.md)                             | Adds a reference to the remote package at the given branch.                                                                                                                    |
| [AddRemotePackageReferenceAtRevision](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferenceatrevision.md)                         | Adds a reference to the remote package at the given revision.                                                                                                                  |
| [AddRemotePackageReferenceAtVersion](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferenceatversion.md)                           | Adds a reference to the remote package at the given version.                                                                                                                   |
| [AddRemotePackageReferenceAtVersionUpToNextMajor](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferenceatversionuptonextmajor.md) | Adds a reference to the remote package at the given version and allows updates up to the next major version.                                                                   |
| [AddRemotePackageReferenceAtVersionUpToNextMinor](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferenceatversionuptonextminor.md) | Adds a reference to the remote package at the given version and allows updates up to the next minor version.                                                                   |
| [AddRemotePackageReferenceWithVersionRange](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addremotepackagereferencewithversionrange.md)             | Adds a reference to the remote package and allows updates in the given version range.                                                                                          |
| [AddResourcesBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addresourcesbuildphase.md)                                                   | Creates a new resources build phase for a given target.                                                                                                                        |
| [AddShellScriptBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addshellscriptbuildphase.md)                                               | Creates a new copy shell script phase for a given target.                                                                                                                      |
| [AddShellScriptBuildPhaseBeforeTargetPostprocess](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addshellscriptbuildphasebeforetargetpostprocess.md) | Creates a new copy shell script phase for a given target.                                                                                                                      |
| [AddSourcesBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addsourcesbuildphase.md)                                                       | Creates a new sources build phase for a given target.                                                                                                                          |
| [AddTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addtarget.md)                                                                             | Creates a new native target.                                                                                                                                                   |
| [AddTargetDependency](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addtargetdependency.md)                                                         | Creates a dependency between this target and another target. The other target may be in a different project.                                                                   |
| [BuildConfigByName](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/buildconfigbyname.md)                                                             | Returns the GUID of build configuration with the given name for the specific target.                                                                                           |
| [BuildConfigNames](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/buildconfignames.md)                                                               | Returns the names of the build configurations available in the project.                                                                                                        |
| [ClearKnownRegions](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/clearknownregions.md)                                                             | Removes the deprecated regions that get added automatically in Xcode Project.                                                                                                  |
| [ContainsFileByProjectPath](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/containsfilebyprojectpath.md)                                             | Checks if the project contains a file with the given project path.                                                                                                             |
| [ContainsFileByRealPath](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/containsfilebyrealpath.md)                                                   | Checks if the project contains a file with the given physical path.                                                                                                            |
| [ContainsFramework](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/containsframework.md)                                                             | Checks whether the given system framework is a dependency of a target.                                                                                                         |
| [FindFileGuidByProjectPath](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/findfileguidbyprojectpath.md)                                             | Finds a file with the given project path in the project.                                                                                                                       |
| [FindFileGuidByRealPath](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/findfileguidbyrealpath.md)                                                   | Finds a file with the given physical path in the project.                                                                                                                      |
| [GetAllBuildPhasesForTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getallbuildphasesfortarget.md)                                           | Returns all build phases for the specified target.                                                                                                                             |
| [GetBaseReferenceForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getbasereferenceforconfig.md)                                             | Gets the base configuration reference GUID for the specified build configuration.                                                                                              |
| [GetBuildPhaseName](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getbuildphasename.md)                                                             | Returns the name of the build phase with the specified GUID.                                                                                                                   |
| [GetBuildPhaseType](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getbuildphasetype.md)                                                             | Returns the type of the build phase with the specified GUID.                                                                                                                   |
| [GetBuildPropertyForAnyConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getbuildpropertyforanyconfig.md)                                       | Gets a build property value for the given name in all the build configurations for the specified target(s). If a property has multiple values, those are delimited by a space. |
| [GetBuildPropertyForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getbuildpropertyforconfig.md)                                             | Gets a build property value for the given name in the specified build configuration(s). If a property has multiple values they are delimited by a space.                       |
| [GetCompileFlagsForFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getcompileflagsforfile.md)                                                   | Returns compile flags set for the specific file on a given target.                                                                                                             |
| [GetCopyFilesBuildPhaseByTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getcopyfilesbuildphasebytarget.md)                                   | Returns the GUID of matching copy files build phase for the given target.                                                                                                      |
| [GetEntitlementFilePathForTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getentitlementfilepathfortarget.md)                                 | Returns the relative path to the entitlement file for the specified build target.                                                                                              |
| [GetFrameworksBuildPhaseByTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getframeworksbuildphasebytarget.md)                                 | Returns the GUID of frameworks build phase for the given target.                                                                                                               |
| [GetHeadersBuildPhaseByTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getheadersbuildphasebytarget.md)                                       | Returns the GUID of the headers build phase for the given target.                                                                                                              |
| [GetRealPathsOfAllFiles](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getrealpathsofallfiles.md)                                                   | Return a list of all known files.                                                                                                                                              |
| [GetResourcesBuildPhaseByTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getresourcesbuildphasebytarget.md)                                   | Returns the GUID of resources build phase for the given target.                                                                                                                |
| [GetShellScriptBuildPhaseForTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getshellscriptbuildphasefortarget.md)                             | Returns the GUID of matching copy shell script build phase for the given target.                                                                                               |
| [GetSourcesBuildPhaseByTarget](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getsourcesbuildphasebytarget.md)                                       | Returns the GUID of sources build phase for the given target.                                                                                                                  |
| [GetTargetProductFileRef](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/gettargetproductfileref.md)                                                 | Returns the file reference of the artifact created by building target.                                                                                                         |
| [GetUnityFrameworkTargetGuid](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getunityframeworktargetguid.md)                                         | Returns the GUID of the framework target in Unity project.                                                                                                                     |
| [GetUnityMainTargetGuid](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getunitymaintargetguid.md)                                                   | Returns the GUID of the main target in Unity project.                                                                                                                          |
| [InsertCopyFilesBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/insertcopyfilesbuildphase.md)                                             | Creates a new copy files build phase for a given target.                                                                                                                       |
| [InsertShellScriptBuildPhase](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/insertshellscriptbuildphase.md)                                         | Creates a new shell script build phase for a given target.                                                                                                                     |
| [ProjectGuid](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/projectguid.md)                                                                         | Returns the GUID of the project.                                                                                                                                               |
| [ReadFromFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/readfromfile.md)                                                                       | Reads the project from a file identified by the given path.                                                                                                                    |
| [ReadFromStream](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/readfromstream.md)                                                                   | Reads the project from the given text reader.                                                                                                                                  |
| [ReadFromString](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/readfromstring.md)                                                                   | Reads the project from the given string.                                                                                                                                       |
| [RemoveAssetTag](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removeassettag.md)                                                                   | Removes an asset tag.                                                                                                                                                          |
| [RemoveAssetTagForFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removeassettagforfile.md)                                                     | Removes an asset tag for the given file.                                                                                                                                       |
| [RemoveAssetTagFromDefaultInstall](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removeassettagfromdefaultinstall.md)                               | Removes the asset tag from the list of tags to download during initial installation.                                                                                           |
| [RemoveBuildConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removebuildconfig.md)                                                             | Removes all build configurations with the given name from all targets in the project.                                                                                          |
| [RemoveFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removefile.md)                                                                           | Removes the given file from project.                                                                                                                                           |
| [RemoveFileFromBuild](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removefilefrombuild.md)                                                         | Removes the given file from the list of files to build for the given target.                                                                                                   |
| [RemoveFrameworkFromProject](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/removeframeworkfromproject.md)                                           | Removes a system framework dependency for the specified target.                                                                                                                |
| [ReplaceFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/replacefile.md)                                                                         | Replaces a specified file with a new file.                                                                                                                                     |
| [SetBaseReferenceForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setbasereferenceforconfig.md)                                             | Sets the base configuration reference for the specified build configuration.                                                                                                   |
| [SetBuildProperty](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setbuildproperty.md)                                                               | Sets a build property to the given value in all build configurations for the specified target(s).                                                                              |
| [SetBuildPropertyForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setbuildpropertyforconfig.md)                                             | Sets a build property to the given value in the specified build configuration(s).                                                                                              |
| [SetCompileFlagsForFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setcompileflagsforfile.md)                                                   | Sets the compilation flags for the given file in the given target.                                                                                                             |
| [SetDevelopmentRegion](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setdevelopmentregion.md)                                                       | Sets the default language and region for the bundle in Xcode Project.                                                                                                          |
| [SetTeamId](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/setteamid.md)                                                                             | Sets the Team ID of an Xcode project.                                                                                                                                          |
| [TargetGuidByName](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/targetguidbyname.md)                                                               | Returns the GUID of the native target with the given name.                                                                                                                     |
| [UpdateBuildProperty](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/updatebuildproperty.md)                                                         | Adds and removes values from a build property in all build configurations for the specified target(s).                                                                         |
| [UpdateBuildPropertyForConfig](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/updatebuildpropertyforconfig.md)                                       | Adds and removes values from a build property in the given build configuration.                                                                                                |
| [WriteToFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/writetofile.md)                                                                         | Writes the project contents to the specified file.                                                                                                                             |
| [WriteToStream](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/writetostream.md)                                                                     | Writes the project contents to the specified text writer.                                                                                                                      |
| [WriteToString](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/writetostring.md)                                                                     | Writes the contents of the project to string.                                                                                                                                  |

## Static Methods

| Method                                                                                                               | Description                                                       |
| -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [GetPBXProjectPath](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getpbxprojectpath.md)           | Returns the path to PBX project in the given Unity build path.    |
| [GetUnityTestTargetName](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/getunitytesttargetname.md) | Returns the default test target name.                             |
| [IsBuildable](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/isbuildable.md)                       | Checks if a file with the given extension can be built by Xcode.  |
| [IsKnownExtension](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/isknownextension.md)             | Checks if files with the given extension are known to PBXProject. |
