Skip to main content
net10.0net10.0-windows7.0.NETFramework4.5.NETFramework4.6.1.NETFramework4.6.2net6.0

Core library of the NewLife framework: logging (file/network), configuration (XML/JSON/HTTP), cache (memory/distributed), networking (TCP/UDP/HTTP/WebSocket), serialization (binary/XML/JSON), APM tracing, IoC container, actor model, timer scheduler and plugin framework. NativeAOT-ready, with built-in runtime localization; targets 11 frameworks from .NET Framework 4.5 to .NET 10.0. 核心组件库:日志、配置、缓存、网络、序列化、APM 性能追踪、对象容器、并行模型、定时调度与插件框架;原生 AOT 就绪,内置运行时多语言消息;单包覆盖 .NET Framework 4.5 至 .NET 10.0 共 11 个目标框架。

Published
Oct 20, 2026
yesterday
Total Downloads
1.9M
1,913,724

Install

dotnet add package NewLife.Core --version 12.0.2026.1020-beta1352
ProductVersions
.NET
net10.0net10.0-windows7.0net6.0net6.0-windows7.0net8.0net8.0-windows7.0
.NET Standard
netstandard2.0netstandard2.1
Other
.NETFramework4.5.NETFramework4.6.1.NETFramework4.6.2

README

NewLife.Core - Core Library

GitHub License Nuget Downloads Nuget Nuget (with prereleases) NativeAOT test

AOT smoke TFM locales

platform arch contributors

🌐 简体中文 | 繁體中文 | 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

Platform support

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)

Feature Key Characteristics
Type Conversion Utility Provides efficient type conversion with support for various formats and exception handling.
String Extensions StringHelper Includes various string operations such as truncation, encoding, and formatting.
Path Extensions PathHelper Intelligently handles multiple path formats to achieve cross-platform compatibility of code.
Data Extensions IOHelper Optimizes IO operations, providing efficient conversion between data streams and byte arrays.
Process Extensions ProcessHelper Simplifies process operations with convenient methods for obtaining and managing process information.
Runtime Information Runtime Provides simple methods to obtain application runtime information, convenient for debugging and diagnostics.
Disposable DisposeBase Provides a standard resource release pattern that effectively prevents memory and resource leaks.
Reflection Extensions Reflect High-performance reflection tooling for fast reading and writing of object members.
Security Extensions SecurityHelper Integrates RSA/AES/DES/MD5 and other encryption and decryption algorithms, simplifying security operations.
Latitude/Longitude Hash GeoHash Encodes latitude and longitude into strings for nearby location search.

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)

Feature Key Characteristics
Configuration System Config Unified configuration framework supporting multiple formats, multiple sources, and hot reload.
Configuration Provider IConfigProvider Unified configuration interface supporting callbacks and a configuration node model.
Core Configuration Setting Manages core component configuration, controlling basic behaviors such as logging and networking.
System Configuration SysConfig Manages application system configuration with support for local, distributed, and encrypted configuration.

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)

Feature Key Characteristics
Unified Cache Interface ICache Defines standard cache operations, providing multiple implementations such as memory and Redis.
Cache Architecture ICacheProvider Manages and provides ICache instances, supporting multiple coexisting caches.
Memory Cache MemoryCache High-performance standalone memory cache supporting expiration and capacity policies.
Object Pool ObjectPool Reuses expensive objects to improve performance and reduce GC pressure.
Object Pool Pool CAS-based high-performance general-purpose object pool that reduces GC pressure.
Distributed Cache NewLife.Redis Redis-based distributed cache implementation supporting multiple data structures.
Vector Store IVectorStore Vector collection management interface supporting Top-K similarity search, providing vector retrieval infrastructure for AI applications.

High-Performance Buffers (7)

Feature Key Characteristics
Data Packet IPacket Core data packet interface for zero-copy slicing and chained packets.
Buffers High-performance buffer operation library aggregating components such as Span and pooled writers.
Pooled Writer PooledByteBufferWriter ArrayPool-based pooled buffer writer supporting dynamic expansion.
Span Reader SpanReader Zero-allocation high-performance binary stream parser supporting little/big endian.
Span Writer SpanWriter Zero-allocation high-performance binary data writer supporting little/big endian.
Span Helper SpanHelper A collection of Span/ReadOnlySpan extension methods that simplifies memory operations.
Sequence Reader SequenceReader Cross-segment sequential reader (patched with shims for older frameworks, available on all 11 TFMs).

Application Framework (15)

Feature Key Characteristics
Object Container ObjectContainer Lightweight dependency injection supporting multiple lifetimes and injection patterns.
Lightweight Application Host Host Simplifies application hosting to easily build long-running background services.
Plugin Framework IPlugin Provides a standardized plugin management mechanism for modular application development.
Parallel Model Actor Simplified concurrent programming model that improves throughput through message queue processing.
Deferred Queue DeferredQueue Aggregates high-frequency changes and persists them in batches, reducing write amplification.
Event Bus EventBus In-process event dispatch supporting topic routing and queue-style messages.
Weak Reference Delegate WeakAction Solves the memory leak problem of event subscriptions and enables safe event handling.
Script Engine ScriptEngine Supports dynamic C# compilation and execution, providing flexible scripting extensibility.
Compression and Decompression Integrates multiple compression algorithms and provides a unified interface for data compression.
Archive Compression Tar and 7Zip Covers advanced archive compression usage for Tar/Tar.Gz and 7Zip.
Machine Information MachineInfo Comprehensively obtains hardware information with support for Windows and Linux systems.
Pinyin Library PinYin Efficient Chinese character to Pinyin library supporting full and abbreviated spelling with superior performance.
Data Table DbTable An in-memory data table for convenient data processing and analysis.
Paging Parameter PageParameter Encapsulates paging logic, supporting pagination in various scenarios such as Web and API.
Snowflake Algorithm Snowflake Distributed unique ID generation algorithm guaranteeing ID uniqueness under high concurrency.

Security and Tokens (3)

Feature Key Characteristics
Distributed Digital Signature Token TokenProvider Generates and validates distributed tokens, ensuring security between multiple nodes.
Web General Token JwtBuilder Provides generation, decoding, and validation of JWT tokens, simplifying Web authentication.
Token HTTP Filter TokenHttpFilter Automatically injects tokens into HTTP requests, intercepting 401/403 for automatic renewal.

Networking (13)

Feature Key Characteristics
Network Server NetServer High-performance TCP/UDP/Unix domain socket server encapsulating sessions and data handling.
Network Client NetClient Unified TCP/UDP/Unix network client that simplifies connection and send/receive.
Message IMessage Request-response message contract carrying direction semantics and frame read/write.
Message Protocol Stack MessagePump Frame pump + stateless codec single stack supporting large streaming frame bodies and backpressure.
Data Pipeline Pipe Zero-copy data pipeline aligned with the System.IO.Pipelines shape.
Simple Remote Message Exchange Protocol SRMP Lightweight RPC protocol supporting binary serialization and UDP transport.
Load Balancing and Failover LoadBalancer Provides three multi-node scheduling strategies: Failover, polling, and racing.
HTTP Client ApiHttpClient Based on an HttpClient wrapper, simplifying the calling and handling of Web APIs.
HTTP Server HttpServer (Embedded Devices) Lightweight Http server supporting middleware pipelines, parameterized routing, and static file serving.
Network Download WebClientX Enhanced WebClient supporting multi-threaded and resumable downloads.
WebSocket Server (a powerful tool for IoT downlink notifications) High-performance WebSocket server suitable for IoT message push.
WebSocket Bidirectional Communication Introduces practices for handshake, frame handling, heartbeat, and connection close.
File Storage Client EasyClient HTTP file storage client for EasyIO or OSS.

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. NuGet
NewLife.XCode Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. NuGet
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. NuGet
NewLife.Remoting Protocol communication and RPC framework for client/server applications and IoT devices. NuGet
NewLife.Agent Installs .NET applications as OS daemons: Windows services and Linux systemd. NuGet
NewLife.Templates dotnet new project templates for console, web, API, service, data and IoT projects. NuGet
Data & Messaging
NewLife.Redis Redis client with microsecond latency, millions of ops/s and built-in message queues. NuGet
NewLife.RocketMQ Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. NuGet
NewLife.MQTT MQTT client and server, including Alibaba Cloud IoT connectivity. NuGet
NewLife.NovaDb Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. NuGet
NewLife.MySql MySql driver and helper layer built on the NewLife data stack. NuGet
Web, AI & Distributed
NewLife.Cube Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. NuGet
Stardust Distributed service platform: node management, APM, configuration center, registry and release center. NuGet
AntJob Distributed task and real-time data scheduling platform with sharding, retries and backfill. NuGet
NewLife.AI Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. NuGet
Industrial & IoT
NewLife.IoT IoT standard library defining protocol contracts and device abstractions. NuGet
NewLife.Modbus Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. NuGet
NewLife.Siemens Siemens PLC protocol on top of NewLife.IoT. NuGet
NewLife.Omron Omron PLC protocol on top of NewLife.IoT. NuGet
NewLife.Melsec Mitsubishi Melsec PLC protocol on top of NewLife.IoT. NuGet
NewLife.OPC OPC client for industrial data access. —
NewLife.BACnet BACnet building-automation protocol stack. NuGet
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. NuGet
NewLife.JT809 JT/T 809 platform-to-platform protocol for transport authorities. NuGet
NewLife.JT1078 JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. NuGet
Domain Components
NewLife.Office One package for Excel, Word, PPT, PDF and 15+ document formats. NuGet
NewLife.Audio Cross-platform audio: codecs, device I/O, DSP, containers and streaming. NuGet
NewLife.Video Video codecs, container formats, frame processing and streaming. NuGet
NewLife.Map Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. NuGet
NewLife.IP IPv4 geolocation with an offline memory-mapped database and an online API fallback. NuGet
Tools & Products
CrazyCoder Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. NuGet
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: 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.0927) 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.

Changes from Previous Version

No structural changes between v12.0.2026.1019-beta1502 and v12.0.2026.1020-beta1352.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 11 target frameworks; confirm the exact target used by your application.The published metadata declares 15 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.