You can reference the NuGet package of OceanBase Connector/NET in the following ways:
Reference a NuGet package
If you can find the package in the default NuGet source, you can directly add the package reference to the project file (.csproj):
<ItemGroup>
<PackageReference Include="Oceanbase.ManagedDataAccess" Version="1.0.0" />
</ItemGroup>
Configure a local package source
If you build the package locally, the default NuGet source cannot locate it. You need to configure the local package source.
Method 1: Specify the package source by using the command line (Recommended)
When you run the dotnet add command, specify the package source by using the --source option:
dotnet add <your project.csproj> package Oceanbase.ManagedDataAccess --version 1.0.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 the nuget.config file
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 the package reference to the project and resolve it from the local source.