OcppSharp 1.0.0

Suggested Alternatives

OcppSharp 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package OcppSharp --version 1.0.0
                    
NuGet\Install-Package OcppSharp -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OcppSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OcppSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="OcppSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OcppSharp --version 1.0.0
                    
#r "nuget: OcppSharp, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OcppSharp@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OcppSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=OcppSharp&version=1.0.0
                    
Install as a Cake Tool

ocpp-sharp

An implementation of the Open Charge Point Protocol (OCPP) in C#.

Currently supported versions:

  • Ocpp 1.6
  • Ocpp 2.0.1

Table of contents

Dependencies

The library itself targets all dotnet versions from .NET 8 up to .NET 10

The example projects target .NET 8

Features

  • C# classes for all messages of the OCPP-Protocol.
  • Easy to set up server and event system for processing messages.

What it isn't

It's not a ready-to-go backend server. You still have to implement what happens once an OCPP-Message has been received and how respond accordingly.

Possible use cases

  • Automating certain ocpp-communication
  • Emulating a charge point
  • Implementation of a basic backend server for charge points

Running the examples

A minimalistic client and server example can be found under /ocpp-sharp.examples

Start the server:

cd ./ocpp-sharp.examples/server
dotnet run

And then a client:

cd ./ocpp-sharp.examples/client
dotnet run

The examples are preconfigured to connect to each other on localhost:8000
and exchange some example messages.

Basic server code

using OcppSharp.Server;
using OcppSharp.Protocol.Version16.RequestPayloads;
using OcppSharp.Protocol.Version16.ResponsePayloads;
using OcppSharp.Protocol;

namespace OcppApp;

public class Program
{
    public static void Main(string[] args)
    {
        // Set up a server to listen on port 80
        // Stations will be connecting to ws://<Hostname>/ocpp16/<Station ID>
        using OcppSharpServer server = new("/ocpp16", [ProtocolVersion.OCPP16], 80);

        server.RegisterHandler<BootNotificationRequest>((server, sender, request) =>
        {
            Console.WriteLine($"Received BootNotification! (Message ID = {request.FullRequest!.MessageId})");
            Console.WriteLine($"Vendor: {request.ChargePointVendor}");
            Console.WriteLine($"Serial Number: {request.ChargePointSerialNumber}");
            // ...

            // Always need to send a response
            return new BootNotificationResponse()
            {
                CurrentTime = DateTime.Now,
                Interval = 90 // Heartbeat Interval
            };
        });

        server.Start();
        Console.WriteLine("Server started!");
        Console.ReadLine();
        server.Stop();
    }
}

Motivation

This project was part of a private OCPP-Backend project. It was then split up into its own project here.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 0 6/13/2026
1.0.1 44 6/9/2026 1.0.1 is deprecated because it is no longer maintained.
1.0.0 50 6/9/2026 1.0.0 is deprecated because it is no longer maintained.