You can reference the NuGet package of OceanBase Connector/NET in the following two ways:
Reference the package by using NuGet
If the package is available in the default NuGet source, you can directly add a package reference to the project file (.csproj):
<ItemGroup>
<PackageReference Include="OceanBase.ManagedDataAccess" Version="1.1.0" />
</ItemGroup>
Use a local package source
The NuGet package built locally cannot be located by default. You need to configure a local package source.
Method 1: Specify the package source by using the command line (Recommended)
When you run the dotnet add command, specify the directory where the package is located by using the --source option:
dotnet add <your project.csproj> package OceanBase.ManagedDataAccess --version 1.1.0 --source "<package repository>" --source "https://api.nuget.org/v3/index.json"
Note
If you use the official NuGet source, retain --source "https://api.nuget.org/v3/index.json".
Method 2: Configure nuget.config
Create a nuget.config file in the project directory and add the local package source:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local-oceanbase" value="<package path>/packages" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
After the configuration is completed, you can add a package reference to the project to resolve the package from the local source.
