Scripts2026年7月20日·1 分钟阅读

.NET Runtime — Cross-Platform Runtime for Cloud, Desktop, and IoT Apps

The open-source runtime powering .NET applications across Linux, macOS, and Windows with the CoreCLR JIT, garbage collector, and base class libraries.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
.NET Runtime Overview
先审查命令
npx -y tokrepo@latest install 5703176f-83d3-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

The .NET Runtime is the execution engine behind all .NET applications. It includes CoreCLR (the JIT compiler and garbage collector), the base class libraries, and the host that bootstraps apps. Microsoft open-sourced the entire stack, and it runs natively on Linux, macOS, and Windows.

What .NET Runtime Does

  • Executes C#, F#, and VB.NET applications with a high-performance JIT compiler
  • Provides the base class libraries for collections, I/O, networking, and cryptography
  • Manages memory automatically with a generational, concurrent garbage collector
  • Supports ahead-of-time (AOT) compilation via NativeAOT for smaller, faster binaries
  • Runs on x64, ARM64, and ARM32 across Linux, macOS, Windows, and container images

Architecture Overview

The runtime is composed of CoreCLR (the execution engine with RyuJIT compiler, GC, and type system), the CoreFX base class libraries, and the dotnet host that resolves framework versions and launches apps. NativeAOT compiles IL directly to native code at build time, eliminating the JIT for scenarios where startup latency or binary size matters.

Self-Hosting & Configuration

  • Install the SDK from https://dot.net or via package managers like apt, brew, or winget
  • Runtime-only installs are available for production servers that only run pre-built apps
  • Configure GC behavior with environment variables like DOTNET_gcServer and DOTNET_GCHeapCount
  • Use runtimeconfig.json to pin framework versions and set host policies
  • Container images are published on Microsoft Container Registry for Alpine, Debian, and Ubuntu

Key Features

  • RyuJIT compiler with tiered compilation for fast startup and peak throughput
  • NativeAOT for single-file, self-contained binaries with no JIT dependency
  • ReadyToRun (R2R) precompilation to reduce cold-start time in cloud scenarios
  • Built-in diagnostics: EventPipe, dotnet-trace, dotnet-dump, and dotnet-counters
  • Extensive platform support including IoT devices and WebAssembly via Blazor

Comparison with Similar Tools

  • JVM (OpenJDK) — mature ecosystem with broader language support; .NET offers tighter C# integration and NativeAOT
  • Go runtime — simpler concurrency model with goroutines; .NET provides richer libraries and async/await patterns
  • Node.js — strong for I/O-heavy web services; .NET delivers higher throughput for compute-bound work
  • Python (CPython) — easier prototyping; .NET is faster for production workloads and offers static typing

FAQ

Q: Is the .NET Runtime free to use? A: Yes. It is MIT-licensed and maintained by Microsoft with community contributions.

Q: What is the difference between the SDK and the runtime? A: The SDK includes compilers and build tools for development. The runtime is the subset needed to run already-compiled applications.

Q: Can I deploy .NET apps as single-file binaries? A: Yes. Use dotnet publish -r linux-x64 --self-contained for a bundled binary, or NativeAOT for a fully ahead-of-time compiled executable.

Q: Does .NET support ARM and Linux containers? A: Yes. Official container images and SDK builds are available for ARM64 and ARM32 on multiple Linux distributions.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产