NewLife.Core - Core Library



🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
NewLife.Core is the foundation of the NewLife ecosystem: one package for logging, configuration, caching, networking, serialization, scheduling, object container and APM tracing. It is NativeAOT-ready, ships runtime messages in 31 languages, targets 11 frameworks from net45 to net10.0, and powers XCode, Cube, Redis, Stardust and 30+ sibling projects.
Core library tutorial: https://newlifex.com/core
Contents: Quick Start · Why NewLife.Core · Main Features · Ecosystem Map · Documentation · Contributing · Team · License
Quick Start
Install
dotnet add package NewLife.Core
Minimal example
using NewLife.Caching;
using NewLife.Log;
XTrace.UseConsole(); // console log (also writes to file)
XTrace.WriteLine("Hello NewLife");
var cache = new MemoryCache(); // in-memory cache
cache.Set("key", "value", 60); // expires in 60 seconds
var value = cache.Get<String>("key"); // read back
Template scaffolding
Run the following commands in a command line to quickly experience NewLife components:
dotnet new install NewLife.Templates
dotnet new nconsole --name test
cd test
dotnet run
| Item |
Coverage |
| Target frameworks |
11 in one package: net45, net461, net462, netstandard2.0, netstandard2.1, net6.0, net6.0-windows, net8.0, net8.0-windows, net10.0, net10.0-windows |
| OS and architecture |
Windows, Linux, macOS, Android, iOS; x64, x86, arm64, arm, loongarch64, riscv64, s390x |
| NativeAOT |
31 core scenarios measured; multi-RID CI smoke matrix (win-x64, linux-x64, linux-arm64 and linux-loongarch64 are blocking gates). Plugins and scripting are not AOT-compatible by design — see AOT Compatibility Analysis |
| Runtime localization |
31 built-in locales; log and exception messages are localized at runtime without changing call sites (see Localization) |
| Legacy frameworks |
net40: dotnet add package NewLife.Core --version 10.10.2024.801-net40 (net40/net45/net461); net20: --version 10.10.2024.701-net20 (net20 only). Frozen 2024-08 builds that do not track mainline updates. |
Why NewLife.Core
- One package for common infrastructure: logging, configuration, caching, networking, serialization, scheduling, object container and DI — a single reference is enough.
- Broad coverage, modern runtime: 11 target frameworks in one package (net45 → net10.0, including Windows variants), NativeAOT-ready on the core path, and runtime messages localized into 31 languages — the same API for legacy systems and new projects.
- Proven at ecosystem scale: the same foundation runs XCode (single tables of 10 billion rows), Net (1.77M pps / 14.5 Gbps, TCP 1KB), Redis and Stardust (tens of billions of records).
- Restrained dependencies, permissive license: BCL and Microsoft compatibility packages only; MIT, so you can modify and rebrand (see License).
Main Features
Basic Extensions (10)
Logging and Tracing (2)
| Feature |
Key Characteristics |
| Logging ILog |
Supports multiple log output methods and provides powerful asynchronous writing. |
| Tracing ITracer |
Powerful APM performance tracing with support for integration with the Stardust platform. |
Scheduling (3)
| Feature |
Key Characteristics |
| Advanced Timer TimerX |
High-precision timer supporting Cron scheduling and asynchronous periodic execution. |
| Cron Expressions |
Provides Linux Cron-like scheduled tasks with second-level matching. |
| Time Provider TimeProvider |
Unified time abstraction and high-precision elapsed time calculation, convenient for cross-version compatibility. |
Configuration System (4)
Serialization (7)
| Feature |
Key Characteristics |
| Json Serialization |
High-performance Json tool supporting serialization in various complex scenarios. |
| Xml Serialization |
Provides XML serialization and deserialization, supporting conversion between objects and XML. |
| Binary Serialization |
High-performance binary serialization supporting complex object graphs and version control. |
| Advanced Binary Serialization |
An advanced guide to zero-allocation encoding and decoding throughout protocol messages. |
| Csv Parser CsvFile |
Fast reading and writing of CSV files with support for custom delimiters and data binding. |
| Csv Database CsvDb |
Uses CSV files as a database, supporting basic create, read, update, and delete operations. |
| Lightweight Excel Reader ExcelReader |
Reads Excel quickly without Office dependencies, supporting large data volumes. |
Caching (7)
High-Performance Buffers (7)
Application Framework (15)
Security and Tokens (3)
Networking (13)
RPC (ApiServer/ApiClient) has moved to NewLife.Remoting.
Ecosystem Map
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project |
What it does |
Downloads |
| Foundation |
|
|
| NewLife.Core |
Logging, configuration, caching, networking, serialization, scheduling and APM tracing. |
 |
| NewLife.XCode |
Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. |
 |
| NewLife.Net |
High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. |
 |
| NewLife.Remoting |
Protocol communication and RPC framework for client/server applications and IoT devices. |
 |
| NewLife.Agent |
Installs .NET applications as OS daemons: Windows services and Linux systemd. |
 |
| NewLife.Templates |
dotnet new project templates for console, web, API, service, data and IoT projects. |
 |
| Data & Messaging |
|
|
| NewLife.Redis |
Redis client with microsecond latency, millions of ops/s and built-in message queues. |
 |
| NewLife.RocketMQ |
Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. |
 |
| NewLife.MQTT |
MQTT client and server, including Alibaba Cloud IoT connectivity. |
 |
| NewLife.NovaDb |
Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. |
 |
| NewLife.MySql |
MySql driver and helper layer built on the NewLife data stack. |
 |
| Web, AI & Distributed |
|
|
| NewLife.Cube |
Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. |
 |
| Stardust |
Distributed service platform: node management, APM, configuration center, registry and release center. |
 |
| AntJob |
Distributed task and real-time data scheduling platform with sharding, retries and backfill. |
 |
| NewLife.AI |
Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. |
 |
| Industrial & IoT |
|
|
| NewLife.IoT |
IoT standard library defining protocol contracts and device abstractions. |
 |
| NewLife.Modbus |
Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. |
 |
| NewLife.Siemens |
Siemens PLC protocol on top of NewLife.IoT. |
 |
| NewLife.Omron |
Omron PLC protocol on top of NewLife.IoT. |
 |
| NewLife.Melsec |
Mitsubishi Melsec PLC protocol on top of NewLife.IoT. |
 |
| NewLife.OPC |
OPC client for industrial data access. |
— |
| NewLife.BACnet |
BACnet building-automation protocol stack. |
 |
| ZeroIoT |
Lightweight open-source IoT platform with gateway and device management. |
— |
| Vehicle Telematics |
|
|
| NewLife.JT808 |
JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. |
 |
| NewLife.JT809 |
JT/T 809 platform-to-platform protocol for transport authorities. |
 |
| NewLife.JT1078 |
JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. |
 |
| Domain Components |
|
|
| NewLife.Office |
One package for Excel, Word, PPT, PDF and 15+ document formats. |
 |
| NewLife.Audio |
Cross-platform audio: codecs, device I/O, DSP, containers and streaming. |
 |
| NewLife.Video |
Video codecs, container formats, frame processing and streaming. |
 |
| NewLife.Map |
Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. |
 |
| NewLife.IP |
IPv4 geolocation with an offline memory-mapped database and an online API fallback. |
 |
| Tools & Products |
|
|
| CrazyCoder |
Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. |
 |
| GitCandy |
Self-hosted Git source code management system. |
— |
| LuckyClover |
Installs the matching .NET runtime automatically when launched from an older host. |
— |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages. The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
Documentation
Guides
Release notes
Contributing
Build and test
The solution opens in Visual Studio (latest release) and also builds with the .NET CLI; project files stay deliberately simple so that a fresh clone builds out of the box.
dotnet build NewLife.Core/NewLife.Core.csproj -c Release
dotnet test XUnitTest.Core -c Release
- Full parallel run:
Tools/Scripts/run-tests.ps1 (multi-host parallel, timeout guard and trx summary)
- NativeAOT smoke:
AotSmoke/, CI in .github/workflows/aot.yml
- Benchmarks:
Benchmark/ (BenchmarkDotNet)
Repository layout
| Directory |
Description |
NewLife.Core/ |
Core library sources (logging, networking, caching, serialization, …) |
NewLife.Core.SourceGenerator/ |
Source generator shipped as analyzers/ inside the package |
Doc/ |
Capability docs and article index |
Samples/ |
Console / service / Http / IoT / mobile samples |
Benchmark/ |
BenchmarkDotNet performance benchmarks |
XUnitTest.Core/ |
Main unit tests (net10.0) |
XUnitTest.Compat/, XUnitTest.Net6/ |
Cross-version compatibility tests |
AotSmoke/ |
NativeAOT smoke project |
Release
Push a v-prefixed tag (for example v12.0.2026.1024) to trigger .github/workflows/publish.yml. The workflow packs the package, publishes it to NuGet.org and GitHub Packages, and creates a GitHub Release whose notes are taken from the matching ChangeLog.md section (assets include nupkg and snupkg). A manual run only publishes packages and does not create a Release.
Development docs
The Doc/ directory keeps a capability documentation set that mirrors the code: requirements → feature tracking → architecture. These documents are written in Chinese.
Feedback
- Before submitting, make sure
dotnet build and the relevant unit tests pass; follow the repository conventions for code style and commit messages.
- Report bugs and suggestions via Issue; Stars and PRs are welcome.
Team
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto “learning has no seniority — mastery earns respect”.
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
WeChat Official Account: 智能大石头 (scan to follow)

License
This project is licensed under MIT; the strong-name certificate newlife.snk is published so you can build and replace assemblies yourself, and the sources may be modified and redistributed without attribution.
If this project is helpful to you, welcome to Star it, share it with your team, or provide improvement suggestions via Issue/PR.
评论