Before you use Content Moderation SDK for .NET, you must install the required dependencies.
Prerequisites
.NET Framework 4.5 or later is installed.
.NET Standard 2.0 or later is installed.
C# 4.0 or later is installed.
Install the SDK
Install Content Moderation SDK for .NET.
Install the SDK by using the .NET Core command line interface (CLI)
NoteTo install the SDK of a specified version, you must add --version <Version number> to the command. Example:
dotnet add package aliyun-net-sdk-core --version 1.0.0
.If you do not specify the version number of Content Moderation SDK for .NET, the SDK of the latest version is installed.
dotnet add package aliyun-net-sdk-core dotnet add package aliyun-net-sdk-green
Install the SDK by running the
dotnet build
commandAdd the following code to the .csproj file:
<PackageReference Include="aliyun-net-sdk-core" Version="1.5.10" /> <PackageReference Include="aliyun-net-sdk-green" Version="3.6.5" />
Run the following command to install the SDK:
dotnet build
Configure environment variables
In Alibaba Cloud SDK code, you can create a default access credential by defining ALIBABA_CLOUD_ACCESS_KEY_ID
and ALIBABA_CLOUD_ACCESS_KEY_SECRET
environment variables. When you call API operations of Alibaba Cloud services, the system directly accesses the credential, reads your AccessKey pair, and then automatically completes authentication. Before you use the SDK sample code, you must configure environment variables. For more information, see Configure credentials.