Class PBXProject | Platforms iOS | 0.9.0-preview.9
docs.unity3d.com
    Show / Hide Table of Contents

    Class PBXProject

    Inheritance
    Object
    PBXProject
    Namespace: UnityEditor.iOS.Xcode.Custom
    Syntax
    public class PBXProject

    Methods

    AddAssetTagForFile(String, String, String)

    Adds an asset tag for the given file. The asset tags identify resources that will be downloaded via On Demand Resources functionality. A request for specific tag will initiate download of all files, configured for that tag.

    Declaration
    public void AddAssetTagForFile(string targetGuid, string fileGuid, string tag)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The GUID of the file.

    String tag

    The name of the asset tag.

    AddAssetTagToDefaultInstall(String, String)

    Adds the asset tag to the list of tags to download during initial installation. The function does nothing if there are no files that use the given asset tag across the project.

    Declaration
    public void AddAssetTagToDefaultInstall(string targetGuid, string tag)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String tag

    The name of the asset tag.

    AddBuildConfig(String)

    Creates a new set of build configurations for all targets in the project. The number and names of the build configurations is a project-wide setting. Each target has the same number of build configurations and the names of these build configurations is the same. The created configurations are initially empty. Care must be taken to fill them with reasonable defaults. The function throws an exception if a build configuration with the given name already exists.

    Declaration
    public void AddBuildConfig(string name)
    Parameters
    Type Name Description
    String name

    The name of the build configuration.

    AddBuildProperty(IEnumerable<String>, String, String)

    Adds a value to build property list in all build configurations for the specified targets. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void AddBuildProperty(IEnumerable<string> targetGuids, string name, string value)
    Parameters
    Type Name Description
    IEnumerable<String> targetGuids

    The GUIDs of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    AddBuildProperty(String, String, String)

    Adds a value to build property list in all build configurations for the specified target. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void AddBuildProperty(string targetGuid, string name, string value)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    AddBuildPropertyForConfig(IEnumerable<String>, String, String)

    Adds a value to build property list of the given build configurations Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void AddBuildPropertyForConfig(IEnumerable<string> configGuids, string name, string value)
    Parameters
    Type Name Description
    IEnumerable<String> configGuids

    The GUIDs of the build configurations as returned by [[BuildConfigByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    AddBuildPropertyForConfig(String, String, String)

    Adds a value to build property list of the given build configuration Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void AddBuildPropertyForConfig(string configGuid, string name, string value)
    Parameters
    Type Name Description
    String configGuid

    The GUID of the build configuration as returned by [[BuildConfigByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    AddCapability(String, PBXCapabilityType, String, Boolean)

    Declaration
    public bool AddCapability(string targetGuid, PBXCapabilityType capability, string entitlementsFilePath = null, bool addOptionalFramework = false)
    Parameters
    Type Name Description
    String targetGuid
    PBXCapabilityType capability
    String entitlementsFilePath
    Boolean addOptionalFramework
    Returns
    Type Description
    Boolean

    AddCopyFilesBuildPhase(String, String, String, String)

    Creates a new copy files build phase for given target. If the target already has copy files build phase with the same name, dstPath and subfolderSpec configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddCopyFilesBuildPhase(string targetGuid, string name, string dstPath, string subfolderSpec)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String dstPath

    The destination path.

    String subfolderSpec

    The "subfolder spec". The following usages are known: "10" for embedding frameworks; "13" for embedding app extension content; "16" for embedding watch content

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddFile(String, String, PBXSourceTree)

    Adds a new file reference to the list of known files. The group structure is automatically created to correspond to the project path. To add the file to the list of files to build, pass the returned value to [[AddFileToBuild]].

    Declaration
    public string AddFile(string path, string projectPath, PBXSourceTree sourceTree = PBXSourceTree.Source)
    Parameters
    Type Name Description
    String path

    The physical path to the file on the filesystem.

    String projectPath

    The project path to the file.

    PBXSourceTree sourceTree

    The source tree the path is relative to. By default it's [[PBXSourceTree.Source]]. The [[PBXSourceTree.Group]] tree is not supported.

    Returns
    Type Description
    String

    The GUID of the added file. It can later be used to add the file for building to targets, etc.

    AddFileToBuild(String, String)

    Configures file for building for the given native target. A projects containing multiple native targets, a single file or folder reference can be configured to be built in all, some or none of the targets. The file or folder reference is added to appropriate build section depending on the file extension.

    Declaration
    public void AddFileToBuild(string targetGuid, string fileGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The file guid returned by [[AddFile]] or [[AddFolderReference]].

    AddFileToBuildSection(String, String, String)

    Configures file for building for the given native target on specific build section. The function is equivalent to [[AddFileToBuild()]] except that specific build section is specified. A projects containing multiple native targets, a single file or folder reference can be configured to be built in all, some or none of the targets. The file or folder reference is added to appropriate build section depending on the file extension.

    Declaration
    public void AddFileToBuildSection(string targetGuid, string sectionGuid, string fileGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String sectionGuid

    The GUID of the section to add the file to.

    String fileGuid

    The file guid returned by [[AddFile]] or [[AddFolderReference]].

    AddFileToBuildWithFlags(String, String, String)

    Configures file for building for the given native target with specific compiler flags. The function is equivalent to [[AddFileToBuild()]] except that compile flags are specified. A projects containing multiple native targets, a single file or folder reference can be configured to be built in all, some or none of the targets. The file or folder reference is added to appropriate build section depending on the file extension.

    Declaration
    public void AddFileToBuildWithFlags(string targetGuid, string fileGuid, string compileFlags)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The file guid returned by [[AddFile]] or [[AddFolderReference]].

    String compileFlags

    Compile flags to use.

    AddFolderReference(String, String, PBXSourceTree)

    Adds a new folder reference to the list of known files. The group structure is automatically created to correspond to the project path. To add the folder reference to the list of files to build, pass the returned value to [[AddFileToBuild]].

    Declaration
    public string AddFolderReference(string path, string projectPath, PBXSourceTree sourceTree = PBXSourceTree.Source)
    Parameters
    Type Name Description
    String path

    The physical path to the folder on the filesystem.

    String projectPath

    The project path to the folder.

    PBXSourceTree sourceTree

    The source tree the path is relative to. By default it's [[PBXSourceTree.Source]]. The [[PBXSourceTree.Group]] tree is not supported.

    Returns
    Type Description
    String

    The GUID of the added folder reference. It can later be used to add the file for building to targets, etc.

    AddFrameworksBuildPhase(String)

    Creates a new frameworks build phase for given target. If the target already has frameworks build phase configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddFrameworksBuildPhase(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddFrameworkToProject(String, String, Boolean)

    Adds a system framework dependency for the specified target. The function assumes system frameworks are located in System/Library/Frameworks folder in the SDK source tree. The framework is added to Frameworks logical folder in the project.

    Declaration
    public void AddFrameworkToProject(string targetGuid, string framework, bool weak)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String framework

    The name of the framework. The extension of the filename must be ".framework".

    Boolean weak

    true if the framework is optional (i.e. weakly linked) required, false if the framework is required.

    AddResourcesBuildPhase(String)

    Creates a new resources build phase for given target. If the target already has resources build phase configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddResourcesBuildPhase(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddShellScriptBuildPhase(String, String, String, String)

    Creates a new copy shell script phase for given target. If the target already has a shell script build phase with the same name, dstPath and subfolderSpec configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddShellScriptBuildPhase(string targetGuid, string name, string shellPath, string shellScript)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddShellScriptBuildPhase(String, String, String, String, List<String>)

    Creates a new copy shell script phase for given target. If the target already has a shell script build phase with the same name, dstPath and subfolderSpec configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddShellScriptBuildPhase(string targetGuid, string name, string shellPath, string shellScript, List<string> inputPaths)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    List<String> inputPaths

    The shell script input dependencies.

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddSourcesBuildPhase(String)

    Creates a new sources build phase for given target. If the target already has sources build phase configured for it, the function returns the existing phase. The new phase is placed at the end of the list of build phases configured for the target.

    Declaration
    public string AddSourcesBuildPhase(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    AddTarget(String, String, String)

    Creates a new native target. Target-specific build configurations are automatically created for each known build configuration name. Note, that this is a requirement that follows from the structure of Xcode projects, not an implementation detail of this function. The function creates a product file reference in the "Products" project folder which refers to the target artifact that is built via this target.

    Declaration
    public string AddTarget(string name, string ext, string type)
    Parameters
    Type Name Description
    String name

    The name of the new target.

    String ext

    The file extension of the target artifact (leading dot is not necessary, but accepted).

    String type

    The type of the target. For example: "com.apple.product-type.app-extension" - App extension, "com.apple.product-type.application.watchapp2" - WatchKit 2 application

    Returns
    Type Description
    String

    The GUID of the new target.

    BuildConfigByName(String, String)

    Returns the GUID of build configuration with the given name for the specific target. Null is returned if such configuration does not exist.

    Declaration
    public string BuildConfigByName(string targetGuid, string name)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the build configuration.

    Returns
    Type Description
    String

    The GUID of the build configuration or null if it does not exist.

    BuildConfigNames()

    Returns the names of the build configurations available in the project. The number and names of the build configurations is a project-wide setting. Each target has the same number of build configurations and the names of these build configurations is the same. In other words, [[BuildConfigByName()]] will succeed for all targets in the project and all build configuration names returned by this function.

    Declaration
    public IEnumerable<string> BuildConfigNames()
    Returns
    Type Description
    IEnumerable<String>

    An array of build config names.

    ContainsFileByProjectPath(String)

    Checks if the project contains a file with the given project path.

    Declaration
    public bool ContainsFileByProjectPath(string path)
    Parameters
    Type Name Description
    String path

    The project path of the file.

    Returns
    Type Description
    Boolean

    Returns true if the project contains the file, false otherwise.

    ContainsFileByRealPath(String)

    Checks if the project contains a file with the given physical path. The search is performed across all absolute source trees.

    Declaration
    public bool ContainsFileByRealPath(string path)
    Parameters
    Type Name Description
    String path

    The physical path of the file.

    Returns
    Type Description
    Boolean

    Returns true if the project contains the file, false otherwise.

    ContainsFileByRealPath(String, PBXSourceTree)

    Checks if the project contains a file with the given physical path.

    Declaration
    public bool ContainsFileByRealPath(string path, PBXSourceTree sourceTree)
    Parameters
    Type Name Description
    String path

    The physical path of the file.

    PBXSourceTree sourceTree

    The source tree path is relative to. The [[PBXSourceTree.Group]] tree is not supported.

    Returns
    Type Description
    Boolean

    Returns true if the project contains the file, false otherwise.

    ContainsFramework(String, String)

    Checks whether the given system framework is a dependency of a target. The function assumes system frameworks are located in System/Library/Frameworks folder in the SDK source tree.

    Declaration
    public bool ContainsFramework(string targetGuid, string framework)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String framework

    The name of the framework. The extension of the filename must be ".framework".

    Returns
    Type Description
    Boolean

    Returns true if the given framework is a dependency of the given target, false otherwise.

    FindFileGuidByProjectPath(String)

    Finds a file with the given project path in the project, if any.

    Declaration
    public string FindFileGuidByProjectPath(string path)
    Parameters
    Type Name Description
    String path

    The project path of the file.

    Returns
    Type Description
    String

    The GUID of the file if the search succeeded, null otherwise.

    FindFileGuidByRealPath(String)

    Finds a file with the given physical path in the project, if any. The search is performed across all absolute source trees.

    Declaration
    public string FindFileGuidByRealPath(string path)
    Parameters
    Type Name Description
    String path

    The physical path of the file.

    Returns
    Type Description
    String

    The GUID of the file if the search succeeded, null otherwise.

    FindFileGuidByRealPath(String, PBXSourceTree)

    Finds a file with the given physical path in the project, if any.

    Declaration
    public string FindFileGuidByRealPath(string path, PBXSourceTree sourceTree)
    Parameters
    Type Name Description
    String path

    The physical path of the file.

    PBXSourceTree sourceTree

    The source tree path is relative to. The [[PBXSourceTree.Group]] tree is not supported.

    Returns
    Type Description
    String

    The GUID of the file if the search succeeded, null otherwise.

    GetAllBuildPhasesForTarget(String)

    Returns all build phases for the specified target. The type and name of each phases can be queried using [[GetBuildPhaseType]] and [[GetBuildPhaseName]] respectively.

    Declaration
    public string[] GetAllBuildPhasesForTarget(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String[]

    Returns the GUIDs of all build phases for the given target.

    GetBaseReferenceForConfig(String)

    Gets the base configuration reference Guid for the specified build configuration.

    Declaration
    public string GetBaseReferenceForConfig(string configGuid)
    Parameters
    Type Name Description
    String configGuid

    The GUID of the build configuration as returned by [[BuildConfigByName()]].

    Returns
    Type Description
    String

    The GUID of the configuration file being used as the base reference.

    GetBuildPhaseName(String)

    Returns the name of the build phase with the specified GUID. Name can only be set for shell script and copy file build phases. Type will be returned for all other phases (same ass [[GetBuildPhaseTypeForTarget(string)]]. Null will be returned if a phase with the given Guid is not available.

    Declaration
    public string GetBuildPhaseName(string phaseGuid)
    Parameters
    Type Name Description
    String phaseGuid

    GUID of the phase.

    Returns
    Type Description
    String

    The build phase name if it's is defined.

    GetBuildPhaseType(String)

    Returns the type of the build phase with the specified GUID. Currently these build phase types are defined: PBXSourcesBuildPhase, PBXFrameworksBuildPhase, PBXResourcesBuildPhase, PBXCopyFilesBuildPhase, PBXShellScriptBuildPhase.

    Declaration
    public string GetBuildPhaseType(string phaseGuid)
    Parameters
    Type Name Description
    String phaseGuid

    GUID of the phase.

    Returns
    Type Description
    String

    The type of the build phase.

    GetBuildPropertyForAnyConfig(IEnumerable<String>, String)

    Returns the value of a build property in all build configurations for the specified targets. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public string GetBuildPropertyForAnyConfig(IEnumerable<string> targetGuids, string name)
    Parameters
    Type Name Description
    IEnumerable<String> targetGuids
    String name

    The name of the build property.

    Returns
    Type Description
    String

    GetBuildPropertyForAnyConfig(String, String)

    Returns the value of a build property in all build configurations for the specified targets. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public string GetBuildPropertyForAnyConfig(string targetGuid, string name)
    Parameters
    Type Name Description
    String targetGuid
    String name

    The name of the build property.

    Returns
    Type Description
    String

    GetBuildPropertyForConfig(String, String)

    Declaration
    public string GetBuildPropertyForConfig(string configGuid, string name)
    Parameters
    Type Name Description
    String configGuid
    String name
    Returns
    Type Description
    String

    GetCompileFlagsForFile(String, String)

    Returns compile flags set for the specific file. Null is returned if the file has no configured compile flags or the file is not configured for building on the given target.

    Declaration
    public List<string> GetCompileFlagsForFile(string targetGuid, string fileGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The GUID of the file.

    Returns
    Type Description
    List<String>

    The compile flags for the specified file.

    GetCopyFilesBuildPhaseByTarget(String, String, String, String)

    Returns the GUID of matching copy files build phase for the given target. The parameters of existing copy files build phase are matched to the arguments of this function and the GUID of the phase is returned only if a matching build phase is found.

    Declaration
    public string GetCopyFilesBuildPhaseByTarget(string targetGuid, string name, string dstPath, string subfolderSpec)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String dstPath

    The destination path.

    String subfolderSpec

    The "subfolder spec". The following usages are known: "10" for embedding frameworks; "13" for embedding app extension content; "16" for embedding watch content

    Returns
    Type Description
    String

    Returns the GUID of the matching phase or null if it does not exist.

    GetFrameworksBuildPhaseByTarget(String)

    Returns the GUID of frameworks build phase for the given target.

    Declaration
    public string GetFrameworksBuildPhaseByTarget(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the existing phase or null if it does not exist.

    GetPBXProjectPath(String)

    Returns the path to PBX project in the given Unity build path. This function can only be used in Unity-generated projects

    Declaration
    public static string GetPBXProjectPath(string buildPath)
    Parameters
    Type Name Description
    String buildPath

    The project build path

    Returns
    Type Description
    String

    The path to the PBX project file that can later be opened via ReadFromFile function

    GetResourcesBuildPhaseByTarget(String)

    Returns the GUID of resources build phase for the given target.

    Declaration
    public string GetResourcesBuildPhaseByTarget(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the existing phase or null if it does not exist.

    GetShellScriptBuildPhaseForTarget(String, String, String, String)

    Returns the GUID of matching copy shell script build phase for the given target. The parameters of existing shell script build phase are matched to the arguments of this function and the GUID of the phase is returned only if a matching build phase is found.

    Declaration
    public string GetShellScriptBuildPhaseForTarget(string targetGuid, string name, string shellPath, string shellScript)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    Returns
    Type Description
    String

    Returns the GUID of the matching phase or null if it does not exist.

    GetShellScriptBuildPhaseForTarget(String, String, String, String, List<String>)

    Returns the GUID of matching copy shell script build phase for the given target. The parameters of existing shell script build phase are matched to the arguments of this function and the GUID of the phase is returned only if a matching build phase is found.

    Declaration
    public string GetShellScriptBuildPhaseForTarget(string targetGuid, string name, string shellPath, string shellScript, List<string> inputPaths)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    List<String> inputPaths

    The shell script input dependencies.

    Returns
    Type Description
    String

    Returns the GUID of the matching phase or null if it does not exist.

    GetSourcesBuildPhaseByTarget(String)

    Returns the GUID of sources build phase for the given target.

    Declaration
    public string GetSourcesBuildPhaseByTarget(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    Returns the GUID of the existing phase or null if it does not exist.

    GetTargetProductFileRef(String)

    Returns the file reference of the artifact created by building target.

    Declaration
    public string GetTargetProductFileRef(string targetGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    Returns
    Type Description
    String

    The file reference of the artifact created by building target.

    GetUnityTargetName()

    Returns the default main target name in Unity project. The returned target name can then be used to retrieve the GUID of the target via TargetGuidByName function. This function can only be used in Unity-generated projects.

    Declaration
    public static string GetUnityTargetName()
    Returns
    Type Description
    String

    The default main target name.

    GetUnityTestTargetName()

    Returns the default test target name in Unity project. The returned target name can then be used to retrieve the GUID of the target via TargetGuidByName function. This function can only be used in Unity-generated projects.

    Declaration
    public static string GetUnityTestTargetName()
    Returns
    Type Description
    String

    The default test target name.

    InsertCopyFilesBuildPhase(Int32, String, String, String, String)

    Creates a new copy files build phase for given target. The build phase is inserted at the specified position. All defined build phases can be queried using [[GetAllBuildPhasesForTarget(string)]].

    Declaration
    public string InsertCopyFilesBuildPhase(int index, string targetGuid, string name, string dstPath, string subfolderSpec)
    Parameters
    Type Name Description
    Int32 index

    The position at which to insert the new build phase. If it's higher than the total number of build phases the new phase will be added at the end.

    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String dstPath

    The destination path.

    String subfolderSpec

    The "subfolder spec". The following usages are known: "10" for embedding frameworks; "13" for embedding app extension content; "16" for embedding watch content

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    InsertShellScriptBuildPhase(Int32, String, String, String, String)

    Creates a new shell script build phase for given target. The build phase is inserted at the specified position. All defined build phases can be queried using [[GetAllBuildPhasesForTarget(string)]].

    Declaration
    public string InsertShellScriptBuildPhase(int index, string targetGuid, string name, string shellPath, string shellScript)
    Parameters
    Type Name Description
    Int32 index

    The position at which to insert the new build phase. If it's higher than the total number of build phases the new phase will be added at the end.

    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    InsertShellScriptBuildPhase(Int32, String, String, String, String, List<String>)

    Creates a new shell script build phase for given target. The build phase is inserted at the specified position. All defined build phases can be queried using [[GetAllBuildPhasesForTarget(string)]].

    Declaration
    public string InsertShellScriptBuildPhase(int index, string targetGuid, string name, string shellPath, string shellScript, List<string> inputPaths)
    Parameters
    Type Name Description
    Int32 index

    The position at which to insert the new build phase. If it's higher than the total number of build phases the new phase will be added at the end.

    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the phase.

    String shellPath

    The shell path.

    String shellScript

    The shell script.

    List<String> inputPaths

    The shell script input dependencies.

    Returns
    Type Description
    String

    Returns the GUID of the new phase.

    IsBuildable(String)

    Checks if files with the given extension are known to PBXProject. Returns true if the extension is not known by PBXProject.

    Declaration
    public static bool IsBuildable(string ext)
    Parameters
    Type Name Description
    String ext

    The file extension (leading dot is not necessary, but accepted).

    Returns
    Type Description
    Boolean

    Returns true if is the extension is known, false otherwise.

    IsKnownExtension(String)

    Checks if files with the given extension are known to PBXProject.

    Declaration
    public static bool IsKnownExtension(string ext)
    Parameters
    Type Name Description
    String ext

    The file extension (leading dot is not necessary, but accepted).

    Returns
    Type Description
    Boolean

    Returns true if is the extension is known, false otherwise.

    ProjectGuid()

    Returns the GUID of the project. The project GUID identifies a project-wide native target which is used to set project-wide properties. This GUID can be passed to any functions that accepts target GUIDs as parameters.

    Declaration
    public string ProjectGuid()
    Returns
    Type Description
    String

    The GUID of the project.

    ReadFromFile(String)

    Declaration
    public void ReadFromFile(string path)
    Parameters
    Type Name Description
    String path

    ReadFromStream(TextReader)

    Declaration
    public void ReadFromStream(TextReader sr)
    Parameters
    Type Name Description
    TextReader sr

    ReadFromString(String)

    Declaration
    public void ReadFromString(string src)
    Parameters
    Type Name Description
    String src

    RemoveAssetTag(String)

    Removes an asset tag. Removes the given asset tag from the list of configured asset tags for all files on all targets, the list of asset tags configured for initial installation and the list of known asset tags in the Xcode project.

    Declaration
    public void RemoveAssetTag(string tag)
    Parameters
    Type Name Description
    String tag

    The name of the asset tag.

    RemoveAssetTagForFile(String, String, String)

    Removes an asset tag for the given file. The function does nothing if the file is not configured for building in the given target or if the asset tag is not present in the list of asset tags configured for file. If the file was the last file referring to the given tag across the Xcode project, then the tag is removed from the list of known tags.

    Declaration
    public void RemoveAssetTagForFile(string targetGuid, string fileGuid, string tag)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The GUID of the file.

    String tag

    The name of the asset tag.

    RemoveAssetTagFromDefaultInstall(String, String)

    Removes the asset tag from the list of tags to download during initial installation. The function does nothing if the tag is not already configured for downloading during initial installation.

    Declaration
    public void RemoveAssetTagFromDefaultInstall(string targetGuid, string tag)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String tag

    The name of the asset tag.

    RemoveBuildConfig(String)

    Removes all build configurations with the given name from all targets in the project. The number and names of the build configurations is a project-wide setting. Each target has the same number of build configurations and the names of these build configurations is the same. The function does nothing if the build configuration with the specified name does not exist.

    Declaration
    public void RemoveBuildConfig(string name)
    Parameters
    Type Name Description
    String name

    The name of the build configuration.

    RemoveFile(String)

    Removes the given file from project. The file is removed from the list of files to build for each native target and also removed from the list of known files.

    Declaration
    public void RemoveFile(string fileGuid)
    Parameters
    Type Name Description
    String fileGuid

    The GUID of the file or folder reference.

    RemoveFileFromBuild(String, String)

    Removes given file from the list of files to build for the given target.

    Declaration
    public void RemoveFileFromBuild(string targetGuid, string fileGuid)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The GUID of the file or folder reference.

    RemoveFrameworkFromProject(String, String)

    Removes a system framework dependency for the specified target. The function assumes system frameworks are located in System/Library/Frameworks folder in the SDK source tree.

    Declaration
    public void RemoveFrameworkFromProject(string targetGuid, string framework)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String framework

    The name of the framework. The extension of the filename must be ".framework".

    ReplaceFile(String, String, PBXSourceTree)

    Replaces the file with given GUID with the specified file.

    Declaration
    public void ReplaceFile(string fileGuid, string path, PBXSourceTree source = PBXSourceTree.Absolute)
    Parameters
    Type Name Description
    String fileGuid

    The GUID of the file or folder reference.

    String path

    The physical path to the new file on the filesystem

    PBXSourceTree source

    SetBaseReferenceForConfig(String, String)

    Sets the base configuration reference for the specified build configuration. If the baseReference parameter is null, the base reference is removed.

    Declaration
    public void SetBaseReferenceForConfig(string configGuid, string baseReference)
    Parameters
    Type Name Description
    String configGuid

    The GUID of the build configuration as returned by [[BuildConfigByName()]].

    String baseReference

    The GUID of the configuration file to be used as the base reference.

    SetBuildProperty(IEnumerable<String>, String, String)

    Adds a value to build property list in all build configurations for the specified targets. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void SetBuildProperty(IEnumerable<string> targetGuids, string name, string value)
    Parameters
    Type Name Description
    IEnumerable<String> targetGuids

    The GUIDs of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    SetBuildProperty(String, String, String)

    Adds a value to build property list in all build configurations for the specified target. Duplicate build properties are ignored. Values for names "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS" are quoted if they contain spaces.

    Declaration
    public void SetBuildProperty(string targetGuid, string name, string value)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String name

    The name of the build property.

    String value

    The value of the build property.

    SetBuildPropertyForConfig(IEnumerable<String>, String, String)

    Declaration
    public void SetBuildPropertyForConfig(IEnumerable<string> configGuids, string name, string value)
    Parameters
    Type Name Description
    IEnumerable<String> configGuids
    String name
    String value

    SetBuildPropertyForConfig(String, String, String)

    Declaration
    public void SetBuildPropertyForConfig(string configGuid, string name, string value)
    Parameters
    Type Name Description
    String configGuid
    String name
    String value

    SetCompileFlagsForFile(String, String, List<String>)

    Sets the compilation flags for the given file in the given target.

    Declaration
    public void SetCompileFlagsForFile(string targetGuid, string fileGuid, List<string> compileFlags)
    Parameters
    Type Name Description
    String targetGuid

    The GUID of the target as returned by [[TargetGuidByName()]].

    String fileGuid

    The GUID of the file.

    List<String> compileFlags

    The list of compile flags or null if the flags should be unset.

    SetTeamId(String, String)

    Declaration
    public void SetTeamId(string targetGuid, string teamId)
    Parameters
    Type Name Description
    String targetGuid
    String teamId

    TargetGuidByName(String)

    Returns the GUID of the native target with the given name. In projects produced by Unity the main target can be retrieved via GetUnityTargetName function, whereas the test target name can be retrieved by GetUnityTestTargetName function.

    Declaration
    public string TargetGuidByName(string name)
    Parameters
    Type Name Description
    String name

    The GUID identifying the native target.

    Returns
    Type Description
    String

    The name of the native target.

    UpdateBuildProperty(IEnumerable<String>, String, IEnumerable<String>, IEnumerable<String>)

    Declaration
    public void UpdateBuildProperty(IEnumerable<string> targetGuids, string name, IEnumerable<string> addValues, IEnumerable<string> removeValues)
    Parameters
    Type Name Description
    IEnumerable<String> targetGuids
    String name
    IEnumerable<String> addValues
    IEnumerable<String> removeValues

    UpdateBuildProperty(String, String, IEnumerable<String>, IEnumerable<String>)

    Declaration
    public void UpdateBuildProperty(string targetGuid, string name, IEnumerable<string> addValues, IEnumerable<string> removeValues)
    Parameters
    Type Name Description
    String targetGuid
    String name
    IEnumerable<String> addValues
    IEnumerable<String> removeValues

    UpdateBuildPropertyForConfig(IEnumerable<String>, String, IEnumerable<String>, IEnumerable<String>)

    Declaration
    public void UpdateBuildPropertyForConfig(IEnumerable<string> configGuids, string name, IEnumerable<string> addValues, IEnumerable<string> removeValues)
    Parameters
    Type Name Description
    IEnumerable<String> configGuids
    String name
    IEnumerable<String> addValues
    IEnumerable<String> removeValues

    UpdateBuildPropertyForConfig(String, String, IEnumerable<String>, IEnumerable<String>)

    Declaration
    public void UpdateBuildPropertyForConfig(string configGuid, string name, IEnumerable<string> addValues, IEnumerable<string> removeValues)
    Parameters
    Type Name Description
    String configGuid
    String name
    IEnumerable<String> addValues
    IEnumerable<String> removeValues

    WriteToFile(String)

    Declaration
    public void WriteToFile(string path)
    Parameters
    Type Name Description
    String path

    WriteToStream(TextWriter)

    Declaration
    public void WriteToStream(TextWriter sw)
    Parameters
    Type Name Description
    TextWriter sw

    WriteToString()

    Declaration
    public string WriteToString()
    Returns
    Type Description
    String

    Extension Methods

    PBXProjectExtensions.AddAppExtension(PBXProject, String, String, String, String)
    PBXProjectExtensions.AddWatchApp(PBXProject, String, String, String, String, String)
    PBXProjectExtensions.AddWatchExtension(PBXProject, String, String, String, String)
    PBXProjectExtensions.AddFileToEmbedFrameworks(PBXProject, String, String)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023