This topic describes how to prepare the environment before you use the SDK for C# to send and receive messages.

Procedure

  1. Install .NET 5.0 or later, or .NET Core 3.1.
    We recommend that you install .NET 5.0 or later.
  2. Use one of the following methods to add the dependency.
    • Run the following command in the directory of the project:
      dotnet add package RocketMQ.Client --version 5.1.0
    • Add the following dependency to the .csproj file:
      <ItemGroup>
        <PackageReference Include="RocketMQ.Client" Version="5.1.0" />
      </ItemGroup>
  3. Obtain the resources.
    You must create resources that are used in the code of the SDK in the console in advance, including the instance endpoint, topic name, and group ID. For more information, see Step 2: Create resources.
  4. Modify the parameters for the SDK based on the resources that are obtained in 3 and run the sample code. For more information about the sample code, see Sample code.