CanTools.Net 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CanTools.Net --version 0.1.0
                    
NuGet\Install-Package CanTools.Net -Version 0.1.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="CanTools.Net" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CanTools.Net" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CanTools.Net" />
                    
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 CanTools.Net --version 0.1.0
                    
#r "nuget: CanTools.Net, 0.1.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 CanTools.Net@0.1.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=CanTools.Net&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CanTools.Net&version=0.1.0
                    
Install as a Cake Tool

CanTools.Net

CI

A C#/.NET port of the excellent cantools Python library by Erik Moqvist and contributors.

What works today:

  • DBC: read and write, including attributes, value tables, comments, signal groups, long-name resolution, J1939/CAN FD detection and relation attributes.
  • KCD and SYM 6.0: read. DatabaseLoader.LoadFile picks the format from the file extension, or probes the content when the extension is unknown.
  • Encode/decode CAN messages with scaling, choices, floats, and simple and extended multiplexing — verified against the cantools test suite.
  • J1939 frame id and PGN helpers.
  • Log reading: candump (plain, -tz, -l, -tA) and PCAN trace 1.0–2.1.
  • CANopen: read EDS/DCF object dictionaries (CiA 306, $NODEID expressions, compact arrays — verified against python-canopen), project PDO mappings onto ordinary decodable messages, parse and build the CiA 301 frames (NMT, heartbeat, EMCY, SYNC, TIME, SDO), and fold a candump of a CANopen network into typed events with SDO reassembly — segmented and block transfers included. This goes beyond upstream cantools; see CANOPEN.md.
using CanTools.Formats.Dbc;

var db = DbcReader.LoadFile("vehicle.dbc");
var data = db.EncodeMessage("ExampleMessage", new Dictionary<string, SignalValue>
{
    ["Temperature"] = 250.55,
    ["Enable"] = "Enabled",
});
var decoded = db.DecodeMessage("ExampleMessage", data);

More examples — loading databases, decoding log files, J1939, CANopen — in docs/examples.md.

This is an independent port and is not affiliated with the cantools maintainers. CANopen is a registered trademark of CAN in Automation (CiA); this project is not affiliated with or endorsed by CiA. Behavior is verified against the upstream test suite and cross-checked against the Python implementation; see PORTING.md for exactly what has been ported and which deviations exist, and PLAN.md for the roadmap. Not yet ported: ARXML and CDD parsing, KCD/SYM writing, container messages, and the CLI tools.

Work in progress — the API is not stable yet.

License

MIT. Portions derived from cantools, Copyright (c) 2015-2019 Erik Moqvist, also MIT — see THIRD-PARTY-NOTICES.txt.

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 was computed.  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 was computed.  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.1.0 139 7/19/2026
0.2.0 105 7/16/2026
0.1.0 114 7/16/2026