BACnet 4.0.0-beta.2
See the version list below for details.
dotnet add package BACnet --version 4.0.0-beta.2
NuGet\Install-Package BACnet -Version 4.0.0-beta.2
<PackageReference Include="BACnet" Version="4.0.0-beta.2" />
<PackageVersion Include="BACnet" Version="4.0.0-beta.2" />
<PackageReference Include="BACnet" />
paket add BACnet --version 4.0.0-beta.2
#r "nuget: BACnet, 4.0.0-beta.2"
#:package BACnet@4.0.0-beta.2
#addin nuget:?package=BACnet&version=4.0.0-beta.2&prerelease
#tool nuget:?package=BACnet&version=4.0.0-beta.2&prerelease
.NET library for BACnet
<img src="https://raw.githubusercontent.com/ela-compil/BACnet/master/logo.png" alt="BACnet logo" align="right" width="130" />
BACnet (ASHRAE 135) is the standard communication protocol for building-automation systems — HVAC, lighting, access control, and metering. This library is a standalone BACnet stack for .NET: add a NuGet package and talk to BACnet devices from your own code, or expose your application as a BACnet device.
Features
- Transports — BACnet/IP (UDP, IPv4 & IPv6) with BBMD and foreign-device registration; BACnet/Ethernet (pcap); MS/TP and PTP over a serial port
- Client and device (server) roles — send requests and/or answer them from your own object model
- Discovery — Who-Is / I-Am and Who-Has / I-Have, including across routers
- Data access — ReadProperty, WriteProperty, ReadPropertyMultiple, WritePropertyMultiple, ReadRange
- Change of Value — SubscribeCOV / SubscribeProperty and COV notifications
- Alarms & events — event/alarm notifications, alarm summary, and acknowledgement
- More services — object create/delete, atomic file read/write, device-communication-control, reinitialize, time synchronization
- Segmentation of large requests and responses
- Complete ASN.1 encode/decode of the BACnet APDU set, covered by a test suite verified against ASHRAE 135 Annex F
Packages
- BACnet
Core stack — pure-managed BACnet/IP, MS/TP & PTP protocol, encode/decode. No native dependencies. - BACnet.Ethernet
pcap-based BACnet/Ethernet (ISO 8802-3) transport (SharpPcap / PacketDotNet). - BACnet.Serial
Physical serial-port transport (System.IO.Ports) for MS/TP and PTP. - BACnet.Logging.CommonLogging
Optional bridge to route the stack's logs toCommon.Logging.
Supported target frameworks
| Package | net48 | netstandard2.0 | net8.0 | net10.0 |
|---|---|---|---|---|
| BACnet (core) | ✅ | ✅ | ✅ | ✅ |
| BACnet.Ethernet | ✅ | — | ✅ | ✅ |
| BACnet.Serial | ✅ | — | ✅ | ✅ |
| BACnet.Logging.CommonLogging | ✅ | ✅ | ✅ | ✅ |
netstandard2.0 covers .NET 6/7 and other runtimes.
Install
dotnet add package BACnet
# optional native transports:
dotnet add package BACnet.Ethernet
dotnet add package BACnet.Serial
Getting started
A minimal Who-Is device discovery over BACnet/IP:
using System.IO.BACnet;
var client = new BacnetClient(new BacnetIpUdpProtocolTransport(0xBAC0));
client.OnIam += (sender, adr, deviceId, maxApdu, seg, vendorId)
=> Console.WriteLine($"Found device {deviceId} at {adr}");
client.Start();
client.WhoIs();
Console.ReadLine();
On a host with several network interfaces (e.g. Hyper-V/WSL/Docker virtual adapters), tell the transport which one to bind by passing its IP — otherwise it throws an error listing the candidates:
new BacnetIpUdpProtocolTransport(0xBAC0, localEndpointIp: "192.168.1.50").
The Examples/ folder has runnable samples — basic read/write, a device/server,
COV subscription, alarm/event handling, BBMD, a serial device, and more.
Logging
The stack uses Microsoft.Extensions.Logging. By default logging is a no-op; wire a factory once
and everything logs through it:
using Microsoft.Extensions.Logging;
BacnetLogging.Factory = LoggerFactory.Create(b => b.AddConsole());
Console, Serilog, NLog, and log4net all work via their MEL providers. If you already use
Common.Logging, add the BACnet.Logging.CommonLogging package and call b.AddCommonLogging().
Upgrading from 3.x to 4.0
4.0 has a few breaking changes — see MIGRATION.md for details:
- Logging moved from
Common.LoggingtoMicrosoft.Extensions.Logging(theLogproperty is nowILogger). - Native transports split into optional packages: pcap →
BACnet.Ethernet, serial →BACnet.Serial. The MS/TP and PTP protocols stay in the core; useSerialTransport.Mstp(...)/.Ptp(...)fromBACnet.Serial. - Interface selection is explicit when the host has multiple network interfaces. In that case
BacnetIpUdpProtocolTransportno longer picks one for you —Start()throws and lists the candidates. Pass the interface IP:new BacnetIpUdpProtocolTransport(0xBAC0, localEndpointIp: "192.168.1.50"). - Renamed the misspelled enum member
BacnetRejectReason.RECOGNIZED_SERVICEtoUNRECOGNIZED_SERVICE(value unchanged).
GitHub Packages
Releases are also published to GitHub Packages. To restore from there, add the source
https://nuget.pkg.github.com/ela-compil/index.json (a GitHub PAT with read:packages is required).
Credits & history
The stack was originally developed by Morten Kvistgaard — with significant contributions from F. Chaxel, Steve Karg, and the BACnet Stack (in C) — as part of YABE (Yet Another BACnet Explorer). This repository was forked from the YABE SourceForge SVN and is maintained here by Jakub Bartkowiak and the Ela-compil team as an independent library on NuGet; it is a separate codebase from YABE (YABE keeps its own copy of the stack).
Trademarks
"BACnet" and the BACnet logo are registered trademarks of ASHRAE (the American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc.). This project is an independent, community-maintained implementation of the BACnet protocol; it is not affiliated with, endorsed by, or sponsored by ASHRAE or BACnet International. The name and logo are used only to identify the protocol this library implements.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on BACnet:
| Package | Downloads |
|---|---|
|
NodalisEngine
.NET implementation of the Nodalis PLC engine for use in running PLC programs that have been compiled to Javascript using the Nodalis Compiler. |
|
|
BACnetHelper
Package Description |
|
|
ProtocolGateway
轻量级协议转发中间类库,支持 Serial/MQTT/TCP/HTTP/BACnet/OPC UA 等工业协议互转 |
|
|
PlcSimulator.Core
PLC Simulator Core - industrial protocol simulation engine supporting S7, Modbus, OPC UA, BACnet, MQTT and Lua scripting. |
|
|
VerticalField.VFS.BacnetManager
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on BACnet:
| Repository | Stars |
|---|---|
|
IOT-CS/IOTCS
工业智能网关,基于.net core3.1的跨平台物联网网关。支持不同设备驱动(PLC、CNC、数据库、串口设备、上位机、OPC UA、MQTT)具备二次开发驱动的能力实现与Thingsboard进行数据通讯。同时支持多资源配置化管理,MQTT、MYSQL、WEBHOOK等多种类型,实现数据的快速推送,提供简单的驱动开发接口。
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0-beta.3 | 51 | 7/6/2026 |
| 4.0.0-beta.2 | 66 | 7/4/2026 |
| 4.0.0-beta.1 | 77 | 7/2/2026 |
| 3.0.2 | 13,546 | 1/21/2026 |
| 3.0.1 | 65,447 | 2/6/2025 |
| 3.0.1-beta9 | 6,281 | 6/13/2024 |
| 3.0.1-beta8 | 481 | 4/22/2024 |
| 3.0.1-beta7 | 307 | 3/19/2024 |
| 3.0.1-beta6 | 7,218 | 11/21/2022 |
| 3.0.1-beta5 | 760 | 11/19/2022 |
| 3.0.1-beta4 | 1,178 | 9/19/2022 |
| 3.0.1-beta3 | 759 | 9/15/2022 |
| 3.0.1-beta2 | 804 | 7/31/2022 |
| 3.0.1-beta10 | 260 | 7/18/2024 |
| 3.0.1-beta | 985 | 1/10/2022 |
| 2.0.4 | 195,738 | 8/18/2021 |
See the changelog: https://github.com/ela-compil/BACnet/blob/master/CHANGELOG.md