NET 7 Preview 1 Released

NET 7 Preview 1 Released

NET 7 is built on the foundation of. NET 6 and includes a unified set of basic libraries, runtime and SDK, which simplifies the development experience and improves developer productivity.

最后更新 2/19/2022 1:01 AM
WeihanLi amazingdotnet
预计阅读 13 分钟
分类
.NET
标签
.NET C#

今天,我们很高兴地宣布 .NET 历史上的下一个里程碑。在庆祝社区和 20 年创新的同时,.NET 7 Preview 1 标志着迈向 .NET 下一个 20 年的第一步。

ASP.NET Core Preview 1EF7 Preview 1 也在今天发布。

NET 7 is built on the foundation of. NET 6 and includes a unified set of basic libraries, runtime and SDK, which simplifies the development experience and improves developer productivity. Key areas of focus for NET 7 include improving support for cloud-native solutions, making it easier to upgrade old projects, and simplifying the developer experience by making it easier to use containers.

NET 7 Preview 1 includes annotations on API support for nullability, ongoing JIT compiler optimizations, new APIs, and support for more hot overloading scenarios.

The. NET version includes products, class libraries, runtimes, and tools, and represents collaboration between multiple teams inside and outside Microsoft. The broader topics covered in this blog post do not cover all key scenarios and investments for. NET 7. They represent a large area, but are only part of all the important work going into. NET 7. We plan to invest extensively in ASP.NET Core, Blazor, EF Core, WinForms, WPF and other platforms, and you can learn more about these areas by reading the product roadmap:

您可以下载适用于 Windows、macOS 和 Linux 的 .NET 7 Preview 1

.NET 7 已通过 Visual Studio 17.2 预览版 1 进行测试。如果您想在 Visual Studio 系列产品中试用 .NET 7,我们建议您使用预览频道版本。Visual Studio for Mac 对 .NET 7 预览版的支持尚不可用,但即将推出。

Modern Client: . NET Multi-Platform Application UI (. NET MAUI)

.NET MAUI 是 .NET 跨平台原生 UI 的未来,将成为 .NET 7 的一部分。周二,我们发布了.NET MAUI Preview 13。我们目前专注于为 .NET 6 提供 .NET MAUI 支持,我们预计很快会提供一个候选版本 (RC)。在我们有可用的 RC 后,我们将专注于发布额外的 RC,直到我们达到一般可用性 (GA) 所需的稳定性。在 .NET MAUI GA 为 .NET 6 发布后,我们将把它包含在 .NET 7 中,并着眼于改进内部开发循环体验、支持最新的 .NET SDK 工具、更快的应用程序性能、共享更多代码以及增强的互操作等主题。查看.NET MAUI 的状态项目路线图以获取更多信息。

Modern Cloud: Containers and Cloud Native

从零开始构建云原生应用程序,利用基于 Web 的现代资源,例如数据库服务托管容器。云原生架构可以通过创建独立于应用程序的其他区域进行部署和扩展的自治子系统(通常称为微服务)来提高大型应用程序的规模,同时降低长期成本。微服务架构是一种流行的方法,因为它很灵活,旨在发展和扩展至单体架构中难以实现的极限。

NET 7 will make it easier to build cloud-native applications by exploring improvements to the developer experience, such as:

  • Streamline the setup and configuration required to implement secure authentication and authorization
  • Improve the performance of application startup and run-time execution.

我们将继续投资Orleans,这是一个 .NET 跨平台框架,用于构建被称为 “分布式 .NET” 的分布式应用程序。我们将继续增强 Orleans 的综合文档,并通过改进 Orleans 与Azure App ServicesAzure Container Apps等现有云服务的集成,使其更易于使用和实施。

Containers are the preferred method for many companies today to deploy cloud-native applications and microservices. Relying on containers presents a number of challenges, including managing compatibility, building and publishing images, making images more secure, and simplifying image size and performance. We believe in the opportunity to create a better experience using. NET containers.

To help customers meet these challenges, we plan to make significant improvements to. NET development using containers in. NET 7. For example, we will explore building containers directly as a new feature of the SDK through MSBuild. We plan to enhance telemetry to improve the observability of the container. We will also focus on making our container images smaller, faster, and more secure, while exploring demanding application models such as rootless and distroless.

Modernization: Upgrading. NET applications

自 .NET 6 发布以来,开发人员一直在升级他们的应用程序,以利用新的性能提升、最小 API 和热重载等生产力特性、新的运行时和 C# 语言创新以及成熟的库和工具生态系统的可用性。在 .NET 7 中,我们将继续使您能够将现有的 .NET 应用程序升级到最新的 .NET 平台和技术。.NET 升级助手中的更多分析器、代码修复程序和对其他应用程序类型的支持将帮助您自信地升级更多应用程序组合,并减少升级所涉及的重复性任务的时间。

We also know that each. NET application model (ASP.NET, WinForms, WPF, etc.) has its own unique challenges in modernization and may lack the functionality needed by developers or support from the platform itself. For some of them, such as WCF, there may be no clear direction. We will focus on providing appropriate guidance, documentation, and tools to make these. NET application models easier to upgrade.

support

.NET 7 是 Current 版本,这意味着它将在发布之日起 18 个月内获得免费支持和补丁。请务必注意,所有版本的质量都是相同的。LTS 和当前版本之间的唯一区别是支持的长度。有关 .NET 支持政策的更多信息,请参阅.NET 和 .NET Core 官方支持政策

major changes

您可以通过阅读 .NET 7 中的重大更改文档找到最新的 .NET 7 重大更改列表。它按区域和版本列出了重大更改,并附有详细说明的链接。

要查看提出了哪些重大更改但仍在审核中,请关注Proposed .NET Breaking Changes GitHub 问题

Preview 1

Preview 1 now provides the following features.

Nullable annotations for Microsoft.Extensions

We are working on Microsoft.Extensions.* Progress has been made in adding annotations to the library to achieve nullability. In. NET 7 Preview 1, the following libraries have been annotated for nullability:

  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Microsoft.Extensions.Logging.Abstractions
  • Microsoft.Extensions.Primitives
  • Microsoft.Extensions.FileSystemGlobbing
  • Microsoft.Extensions.DependencyModel
  • Microsoft.Extensions.Configuration.Abstractions
  • Microsoft.Extensions.FileProviders.Abstractions
  • Microsoft.Extensions.FileProviders.Physical
  • Microsoft.Extensions.Configuration
  • Microsoft.Extensions.Configuration.Binder
  • Microsoft.Extensions.Configuration.CommandLine
  • Microsoft.Extensions.Configuration.EnvironmentVariables
  • Microsoft.Extensions.Configuration.FileExtensions
  • Microsoft.Extensions.Configuration.Ini
  • Microsoft.Extensions.Configuration.Json

到 .NET 7 发布时,我们计划为所有 Microsoft.Extensions.* 库添加可空性注释。您可以查看剩余的库,并在dotnet/runtime#43605处关注进度。

Thank you very much to @maxkoshevoi, who made a great contribution to this work. Without the help of @maxkoshevoi, we wouldn't have gone so far.

the observability

Continue to improve the tracking API:

  • 添加 ActivityContext.TryParse 重载以允许解析和创建 ActivityContext 对象,包括是否从远程父级传播活动上下文(相关问题)。
  • 添加 Activity.IsStopped() 指示 Activity 对象是否停止的方法(相关问题)。

code generation

Community PR (Thank you very much to JIT community contributors!!)

From@am11

将一些旧式内部函数转换为 NamedIntrinsic runtime#62271

From @anthonycanino

将额外的二进制操作添加到 RangeCheck 分析中。runtime#61662

From @SeanWoo

[JIT] [问题:61620] 针对 *x = dblCns 优化 ARM64;runtime#61847

From @ SingleAcceptance

Adjust floating point CSE runtime #63903 when calling better runtime Update the hash of the new CSE when resizing runtime #61984 Overwrite field selection and always normalize SIMD type runtime #61370 in VN Add documentation on how VN numbers memory runtime #60476 Improved forced conversion value runtime #59841 Address under complex local address in block morphing exposes local variable runtime #63100 Copy propagation runtime #63447 when processing embedded allocations Exception Set: Debugger checks and fixes runtime #63539 Implement "mooffset" encoding size optimization in emitOutputAM runtime #62896 Compress the array of operand types and optimize OperIsLocal runtime #63253 Make gtHasRef pay attention to LCL_FLD node runtime #62568 Enable global constant propagation runtime #61209 for GT_LCL_FLD Enable global constant propagation for small types runtime #57726 fgMemoryVNForLoopSideEffects property type master selector runtime #60505

From @RalfKornmannEnvision

CoreRT supports ARM64&Unix runtime #41023

From @weilinwa

Optimize FMA code generation based on overwrite runtime #58196

Dynamic PGO OSR support for Arm64 JIT: OSR that supports synchronization methods JIT: Handling the interaction of OSR, PGO, and tail calls Add the 2009 Jit Architecture Plan (excerpt) JIT: Forward replacement of limited versions of some relays JIT: Saving generic contexts for later virtualization Arm64 Arm64: Memory barrier improvements picture

Use SIMD operations in InitBlkUnroll/CopyBlkUnroll and increase the expansion limit to 128 bytes [Arm64] Continue to expand InitBlock and CopyBlock up to 128 bytes 'cmeq' and 'fcmeq' Vector64.Zero/Vector128.Zero ARM64 include optimizations [arm64] JIT: X % 2 == 0 -> X & 1 == 0 [arm64] JIT: Add symbols/zero extension [arm64] JIT: Enable CSE/Boost for "arrayBase + elementOffset" [arm64] JIT: Fold "A * B + C" into MADD/MSUB loop optimization Pre-generalization loop header creation and loop promotion Loop refactoring and annotation improvements general optimization Accelerate other cross-platform hardware intrinsic functions Implementing Narrow and Widen using SIMDAsHWIntrinsic Add the IsKnownConstant jit assistant and use str.StartsWith ('c ') to optimize'str ==""' Allow JIT to retain HFA/HVA in registers when passing them as parameters/return values Enable support for nint/nuint for Vector64/128/256 Add support for X86Base.Pause() and ArmBase.Yield() Use the preferred area in PAL for JIT reloc prompts Support fast tail calls in R2R Allow indirection to be included in tail calls on x64 Optimize the sequence of indirect unit calls more generally Avoid creating additional local for delegate calls Interoperability: p/Invoke code generation We integrated the p/invoke Source Generator prototyped in. NET 6 into dotnet/runtime and have been converting the runtime library to use it. This means that the converted p/invocations are AOT compatible and no longer need to generate IL Stubs at runtime.

We plan to make the p/invoke source generator available outside of runtime in the future. You can follow the rest of our work in dotnet/runtime #60595.

New APIs in System.Text.Json System.Text.Json comes with some small lifecycle enhancements:

Developers can now access the default singleton JsonSerializerOptions used internally by System.Text.Json. Add a JsonWriterOptions.MaxDepth property and ensure that this value comes from the serialized JsonSerializerOptions.MaxDepth equivalent property (related issues). Add the Patch method to System.Net.Http.Json (related issues). Thermal heavy load improvement The following edits are now allowed in C#hot overloads for Blazor WebAssembly and. NET for iOS and Android (related issues):

Add a static lambda to an existing method Add the lambda that captures this to an existing method that already has at least one lambda that captures this Add a new static or non-virtual instance method to an existing class Add new static fields to existing classes Add a new class Known issues:

Instance fields in newly added classes are not supported Methods and fields newly added to existing or new classes are not visible to reflection You can follow our progress in dotnet/runtime #57365

Specify. NET 7 To use. NET 7, you need to use. NET 7 Target Framework Moniker (TFM) in your project files. For example:

net7.0 The full set of. NET 7 TFM, including operating system-specific TFM.

net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows We hope that upgrading from. NET 6 to. NET 7 should be easy. Please report any significant changes you notice while testing existing applications using. NET 7.

conclusion Microsoft's global diverse team of engineers, working with a highly engaged developer community, is building. NET 7. The broad. NET community, including everyone from students and enthusiasts to open source contributors and corporate customers, is at the heart of. NET, proposing new ideas, regularly contributing code, and moving the. NET ecosystem forward. We are grateful and thank you for your support, contributions and insights.

Welcome to. NET 7.

Keep Exploring

延伸阅读

更多文章
同分类 / 同标签 4/22/2026

Support for. NET by operating system versions (250707 update)

Use virtual machines and test machines to test the support of each version of the operating system for. NET. After installing the operating system, it is passed by measuring the corresponding running time of the installation and being able to run the Stardust Agent.

继续阅读
同分类 / 同标签 2/7/2026

Summary of experience in using AOT

From the very beginning of project creation, you should develop a good habit of conducting AOT release testing in a timely manner whenever new features are added or newer syntax is used.

继续阅读