# AddFileToEmbedFrameworks(PBXProject, string, string, string)

> Adds a framework to a target's Embed Frameworks build phase.

## Definition

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

```csharp
public static void AddFileToEmbedFrameworks(this PBXProject proj, string targetGuid, string fileGuid, string linkToTargetGuid = null)
```

### Parameters

**** (\[PBXProject]\(/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject)): The projects extension method receiver.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The GUID of the destination target, as returned by [PBXProject.TargetGuidByName(string)](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/targetguidbyname.md#targetguidbyname\(string\))).**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The file GUID from [PBXProject.AddFile](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfile.md) or [PBXProject.AddFolderReference](/engine/6000.5/script-reference/unityeditor/ios/xcode/pbxproject/addfolderreference.md).**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional. The GUID of the target that links against this framework. Defaults to `targetGuid`.

### Remarks

Adds the file to an Embed Frameworks copy phase on the `targetGuid`. The embed phase copies the framework into the app bundle. Associates the build file with `linkToTargetGuid` so that the target links the framework. Sets `LD_RUNPATH_SEARCH_PATHS` to `executable_path/Frameworks` on the link target. Enables code signing and header removal on copy. If the file is already in the phase, this method does nothing. **Note**: On iOS, use a different `linkToTargetGuid` when you embed the framework in the app but link it from an extension. iOS doesn't allow you to embed a framework inside another framework. On macOS, omit `linkToTargetGuid` so the same target embeds and links.
