> ## Documentation Index
> Fetch the complete documentation index at: https://developer.onetrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add SDK to App

# Overview

## Before you begin

Prior to implementing the MAUI / .Net SDK into your MAUI / .Net application, you first need to decide what kind of implementation path you need:

* .Net Native iOS and .Net Native Android
* MAUI

## .Net Native iOS and .Net Native Android steps

1. In VisualStudio, right-click on the **Dependencies** folder within your project.

2. Select **Add Project Reference**.

3. Select the **.Net Assembly** tab.

4. Click the **Browse** button.

5. Locate the **cmpsdk.dll** file within the **OneTrust\_CMP\_DotNet7\_DLL** folder (for .Net7 project) or the **OneTrust\_CMP\_DotNet8\_DLL** folder (for .Net8 project).

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/2162f64534996da503d25b269557d9ebed7c8bb3d89b7ddb27424ed73fcf159c-image.png",
        null,
        ""
      ],
      "align": "center",
      "border": true
    }
  ]
}
[/block]

<br />

6. Select **cmpsdk.dll** file.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/2aaea8ec082506ac6ab55bf70c12ae16ea8c8c6a6f3100c16376a1e6e84dda11-image.png",
        null,
        ""
      ],
      "align": "center",
      "border": true
    }
  ]
}
[/block]

<br />

7. Click the **OK** button.  You should see **cmpsdk** in your **Assemblies** section.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/ab869401d8df6fe3a6a8a748c99f3420548823079b4161ba70e1d4ef1db2e18c-image.png",
        null,
        "iOS"
      ],
      "align": "center",
      "border": true,
      "caption": "iOS"
    }
  ]
}
[/block]

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/67922c77ff0ca32a6d0bb9d03a20169c208a11cc7f436d20227c2ea124eeb12d-image.png",
        null,
        "Android"
      ],
      "align": "center",
      "border": true,
      "caption": "Android"
    }
  ]
}
[/block]

<br />

8. For iOS, copy the **OneTrustSDK** folder from the **DotNet-Native-With-UI/otsdk.dotnet.ios** directory and paste it into your **.Net iOS** project.  For Android, do the same with **otsdk.dotnet.android**.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/d596af4946f2803195f8195070d0d3970e09e872cdeae32c1d163d2b16b6e61e-image.png",
        null,
        ""
      ],
      "align": "center",
      "border": true
    }
  ]
}
[/block]

<br />

9. #### For Android only
   1. Navigate to Resources > layout.
   2. Copy each of the XML files in that directory.
   3. Paste them in your project's **Resources > layout** directory.
   4. Select one of the files, then navigate to the **Build action** dropdown on the **Properties** tab and select **AndroidResource**.

> 📘
>
> You will need to repeat this step for each file in the **layout** directory.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/6ce0b18329b6c9fe362616cf232282fca6229130ee4cfd915cc58072bfa6829e-image.png",
        null,
        ""
      ],
      "align": "center",
      "border": true
    }
  ]
}
[/block]

<br />

9. #### For iOS only
   1. Copy **Main.storyboard** and paste it in your project.

[block:image]
{
  "images": [
    {
      "image": [
        "https://files.readme.io/2c861ef31fcd594b92329996ebd92e089ff31ed00583bb612882030eb1707738-image.png",
        null,
        ""
      ],
      "align": "center",
      "border": true
    }
  ]
}
[/block]

<br />

> 📘
>
> We recommend using the **DotNet-Native-With-UI** sample project as a reference on how to communicate with the cmpsdk.dll.

## MAUI steps

First, you need to add the OneTrust SDK's **dll** file to your existing application.

1. In VisualStudio, right click the **References** folder within your project.
2. Select **Add Reference**.
3. Select the **.Net Assembly** tab.
4. Click the **Browse** button.
5. Locate the **cmpsdk.dll** file within the **OneTrust\_CMP\_DotNet7\_DLL** folder (for .Net7 project) or the **OneTrust\_CMP\_DotNet8\_DLL** folder (for .Net8 project).
6. Select the **cmpsdk.dll** file.
7. Click the **OK** button.

> 📘
>
> Since you plan to use the OneTrust UI, you will need to also copy the UI files into your MAUI shared project.

8. Navigate to the **MAUI-With-UI / OneTrust SDK** directory in your downloads.
9. Copy and paste that folder into your existing MAUI project.

> 📘
>
> There are additional dependencies to inject into your existing application. For MAUI, it is necessary to include these files in your project to avoid build errors.

10. For iOS, locate the **MAUI-With-UI / Platforms / iOS / Handlers** folder and copy all files within into your project.

> 📘
>
> For **OneTrust** sample app, the shared project name is **MAUI-With-UI**.  Your project name will be different.
>
> We recommend using the **MAUI-With-UI** sample project as a reference on how to communicate with the cmpsdk.dll. Additionally, we suggest using the **MainPage.xaml** file to launch the OneTrust UI.

## Add SDK to App for Unity

1. Download the **Unity** package from your OneTrust tenant.
2. In the **Unity** engine, import a new package and select the **OneTrust package** from the file explorer.
3. Import all files.
4. From here, a demo scene is available with many common use cases.