Installation

Methods for Installing a Library in MAUI

  • Step 1 -> Create or edit the nuget.config file in your solution directory:

There are 2 methods to configure NuGet packages

Method 1 - Using CLI Command: Navigate to your project directory in the terminal and run the command dotnet add package [LibraryName] to add the desired library.

dotnet nuget add source https://nuget.pkg.github.com/Truvideo/index.json -n truvideo

Method 2 - Using NuGet Package Manager:

Add following lines to the file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="truvideo" value="https://nuget.pkg.github.com/Truvideo/index.json" />
  </packageSources>
</configuration>
  • Step 2 -> Configure GitHub Authentication

    You need to configure your GitHub credentials to access the package feed. Add the following to your `nuget.config` file:

<packageSourceCredentials>
    <truvideo>
        <add key="Username" value="YOUR_GITHUB_USERNAME" />
        <add key="ClearTextPassword" value="YOUR_GITHUB_PAT" />
    </truvideo>
</packageSourceCredentials>
  • Step 3 ->

Replace: - `YOUR_GITHUB_USERNAME` with your GitHub username - `YOUR_GITHUB_PAT` with a GitHub Personal Access Token that has `read:packages` scope

Important: You must create a GitHub Personal Access Token with both `repo` and `packages` permissions. Without these specific permissions, package installation will fail. To create a token:

  1. Go to GitHub Settings > Developer Settings > Personal Access Tokens

  2. Generate a new token with at least `repo` and `packages` scopes

  3. Copy the token immediately as it won't be shown again

Note: Never commit your GitHub credentials to source control. Consider using environment variables or user-specific configuration files.

  • Step 4 -> Install Required Packages

If you configured the package source manually, you need to install the required packages using the following commands:

Check latest version -

Core - Android , iOS

Camera - Android , iOS

Media - Android , iOS

Video - Android , iOS

Image - Android , iOS

#for iOS 
dotnet add package TruVideoCoreiOSBinding --version {version}
dotnet add package TruVideoCameraiOSBinding --version {version}
dotnet add package TruVideoMediaiOSBinding --version {version}
dotnet add package TruVideoVideoiOSBinding --version {version}
dotnet add package TruVideoImageiOSBinding --version {version}

#for Android 
dotnet add package TruVideoCoreAndroidBinding --version {version}
dotnet add package TruVideoCameraAndroidBinding --version {version}
dotnet add package TruVideoMediaAndroidBinding --version {version}
dotnet add package TruVideoVideoAndroidBinding --version {version}
dotnet add package TruVideoImageAndroidBinding --version {version}
  • Step 5 -> Important Project Configuration

When implementing the SDK in your own application, make sure to add the following configuration to your .csproj file:

<PropertyGroup>
    <MtouchExtraArgs>--require-pinvoke-wrappers=true</MtouchExtraArgs>
    <Registrar>static</Registrar>
</PropertyGroup>

You are now ready to proceed with development

Last updated

Was this helpful?