All Products
Search
Document Center

ApsaraMQ for RocketMQ:Set up the C# SDK environment

Last Updated:Mar 11, 2026

Install the ApsaraMQ for RocketMQ C# SDK and configure your .NET project to send and receive messages.

Prerequisites

Before you begin, make sure that you have:

  • .NET 5.0 or later (recommended), or .NET Core 3.1

  • An ApsaraMQ for RocketMQ instance with the following resources. If you have not created these resources, see Create resources.

    • Instance endpoint

    • Topic name

    • Group ID

Install the SDK

Add the RocketMQ.Client NuGet package to your project using either of the following methods.

Option 1: .NET CLI (recommended)

Run the following command in your project directory:

dotnet add package RocketMQ.Client --version 5.2.0-rc1

Option 2: Project file

Add the following package reference to your .csproj file:

<ItemGroup>
  <PackageReference Include="RocketMQ.Client" Version="5.2.0-rc1" />
</ItemGroup>

Verify the installation

After installation, update the following connection parameters in the sample code with the values from your console resources:

ParameterDescription
Instance endpointThe endpoint of your ApsaraMQ for RocketMQ instance
Topic nameThe name of the topic that you created
Group IDThe ID of the consumer group that you created

Run the sample to verify that the SDK connects to your instance. For complete examples, see Sample code.