Skip to main content
Version: 3.0.x

Set up C# client

Install C# client library

This section describes how to install the Pulsar C# client library through the dotnet CLI.

Alternatively, you can install the Pulsar C# client library through Visual Studio. Note that starting from Visual Studio 2017, the dotnet CLI is automatically installed with any .NET Core related workloads. For more information, see Microsoft documentation.

To install the Pulsar C# client library using the dotnet CLI, follow these steps:

  1. Install the .NET Core SDK, which provides the dotnet CLI.

  2. Create a project.

    1. Create a folder for the project.

    2. Open a terminal window and switch to the new folder.

    3. Create the project using the following command.

      dotnet new console
    4. Use dotnet run to test that the app has been created properly.

  3. Add the DotPulsar NuGet package.

    1. Use the following command to install the DotPulsar package.

      dotnet add package DotPulsar
    2. After the command completes, open the .csproj file to see the added reference.

      <PackageReference Include="DotPulsar" Version="2.0.1" />

Connect to Pulsar cluster

To connect to Pulsar using client libraries, you need to specify a Pulsar protocol URL.

You can assign Pulsar protocol URLs to specific clusters and use the pulsar scheme. The following is an example of localhost with the default port 6650:


If you have multiple brokers, separate IP:port by commas:


If you use mTLS authentication, add +ssl in the scheme: