February 17th, 2022

Announcing .NET 7 Preview 1

Jeremy Likness
Principal Program Manager - .NET Web Frameworks

Today, we are excited to announce the next milestone in the history of .NET. While celebrating the community and 20 years of innovation, .NET 7 Preview 1 marks the first step forward towards the next 20 years of .NET.

ASP.NET Core Preview 1 and EF7 Preview 1 are also released today.

.NET 7 builds on the foundation established by .NET 6, which includes a unified set of base libraries, runtime, and SDK, a simplified development experience, and higher developer productivity. Major areas of focus for .NET 7 include improved support for cloud native scenarios, tools to make it easier to upgrade legacy projects, and simplifying the developer experience by making it easier to work with containers.

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

Releases of .NET include products, libraries, runtime, and tooling, and represent a collaboration across multiple teams inside and outside Microsoft. The broader themes covered in this blog post do not encompass all of the key scenarios and investments for .NET 7. They represent large areas but are just a part of all the important work going into .NET 7. We plan to make broad investments in ASP.NET Core, Blazor, EF Core, WinForms, WPF, and other platforms. You can learn more about these areas by reading the product roadmaps:

You can download .NET 7 Preview 1, for Windows, macOS, and Linux.

.NET 7 has been tested with Visual Studio 17.2 Preview 1. We recommend you use the preview channel builds if you want to try .NET 7 with Visual Studio family products. Visual Studio for Mac support for .NET 7 previews isn’t available yet but is coming soon.

Modern client: .NET Multi-platform App UI (.NET MAUI)

.NET MAUI is the future of cross-platform native UI with .NET and will be a part of .NET 7. On Tuesday, we released .NET MAUI Preview 13. We’re currently focused on shipping .NET MAUI support for .NET 6 and we expect to ship a release candidate (RC) soon. After we have an RC available, we will focus on shipping additional RCs until we reach the quality desired for general availability (GA). After .NET MAUI GA has shipped for .NET 6, we’ll include it in .NET 7 and look at improving the inner development loop experience, supporting the latest .NET SDK tooling, faster app performance, sharing more code, and an enhanced interop story. Check out the status of .NET MAUI and project roadmap for more information.

Modern cloud: Cloud Native and containers

Cloud native apps are built from the ground up to take advantage of modern, web-based resources such as database services and hosted containers. The cloud native architecture can improve scale in large applications by creating autonomous subsystems (commonly referred to as microservices) that are deployed and scale independently from other areas of the application while lowering costs in the long term. The microservices architecture is a popular approach because it’s flexible and designed to evolve and scale to limits that are difficult to achieve in a monolithic architecture.

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

  • Simplifying the setup and configuration necessary to implement secure authentication and authorization
  • Improving the performance of application startup and runtime execution.

We’ll continue to make investments in Orleans, a .NET cross-platform framework for building distributed applications that has been referred to as “distributed .NET.” We’ll continue to enhance the comprehensive documentation for Orleans and make it easier to use and implement by improving integration of Orleans with existing cloud services like Azure App Services and Azure Container Apps.

Containers are the preferred way to deploy cloud native apps and microservices for many companies today. Relying on containers presents several challenges including managing compliance, building and publishing images, securing images, and streamlining the size and performance of images. We believe that there is an opportunity to create a better experience with .NET containers.

To help customers face these challenges, we plan to make significant improvements to .NET development with containers in .NET 7. For example, we’ll explore building containers directly via MSBuild as a new capability of the SDK. We plan to enhance telemetry to improve the observability of containers. We’ll also focus on making our container images smaller, faster, and more secure while we explore highly requested models such as rootless and distroless.

Modernize: upgrade .NET apps

Since the release of .NET 6, developers have been upgrading their applications to take advantage of new performance gains, productivity features like minimal APIs and hot reload, new runtime and C# language innovations and the availability of a mature ecosystem of libraries and tools. In .NET 7, we’ll continue to enable you to bring your existing .NET apps forward to the latest .NET platforms and technologies. More analyzers, code fixers, and support for additional app types in the .NET Upgrade Assistant will help you confidently upgrade even more of your application portfolio and spend less time on the repetitive tasks involved in upgrading.

We also know that each of the .NET app models (ASP.NET, WinForms, WPF, etc.) have their own unique challenges with modernization and may be lacking functionality that you need as a developer or support in the platform itself. For some of these, like WCF, there may not be a clear direction for you. We’ll focus on offering appropriate guidance, documentation, and tooling to make these .NET app models easier to upgrade.

Support

.NET 7 is a Current release, meaning it will receive free support and patches for 18 months from the release date. It’s important to note that the quality of all releases is the same. The only difference between LTS and Current releases is the length of support. For more about .NET support policies, see the .NET and .NET Core official support policy.

Breaking changes

You can find the most recent list of breaking changes in .NET 7 by reading the Breaking changes in .NET 7 document. It lists breaking changes by area and release with links to detailed explanations.

To see what breaking changes are proposed but still under review, follow the Proposed .NET Breaking Changes GitHub issue.

Preview 1

The following features are now available in the Preview 1 release.

Nullable annotations for Microsoft.Extensions

We have been making progress on annotating the Microsoft.Extensions.* libraries for 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

By the time .NET 7 is released, we plan on annotating all the Microsoft.Extensions.* libraries for nullability. You can see the remaining libraries, and follow the progress at dotnet/runtime#43605.

A huge thank you to @maxkoshevoi who has been contributing the bulk of this effort. Without @maxkoshevoi’s help, we wouldn’t be nearly as far as we are.

Observability

Continue improving the tracing APIs:

  • Adding the overload to ActivityContext.TryParse allows parsing and creating an ActivityContext object including if the activity context was propagated from a remote parent (related issue).
  • Adding the method Activity.IsStopped() to indicate whether the Activity object is stopped(related issue).

CodeGen

Community PRs (many thanks to JIT community contributors!!)

From @am11

From @anthonycanino

From @SeanWoo

From @SingleAccretion

From @RalfKornmannEnvision

From @weilinwa

Dynamic PGO

Arm64

Loop Optimizations

General Optimizations

Interop: p/Invoke code generation

We integrated the p/invoke source generator that was prototyped in .NET 6 into dotnet/runtime and have been converting the runtime libraries to use it. This means the converted p/invokes are AOT-compatible and no longer require an IL stub to be generated at runtime.

We intend to make the p/invoke source generator available for use outside the runtime in the future. You can follow our remaining work in dotnet/runtime#60595.

New APIs in System.Text.Json

System.Text.Json ships with a couple of minor quality-of-life enhancements:

  • Developers now have access to the default JsonSerializerOptions singleton used internally by System.Text.Json (related issue).
  • Add a JsonWriterOptions.MaxDepth property and ensure this value flows from the equivalent JsonSerializerOptions.MaxDepth property on serialization (related issue).
  • Add Patch methods to System.Net.Http.Json (related issue).

Hot reload improvements

The following edits are now allowed in C# hot reload for Blazor WebAssembly and .NET for iOS and Android (related issue):

  • Adding static lambdas to existing methods
  • Adding lambdas that capture this to existing methods that already have at least one lambda that captures this
  • Adding new static or non-virtual instance methods to existing classes
  • Adding new static fields to existing classes
  • Adding new classes

Known issues:

  • Instance fields in newly added classes are not supported
  • Newly added methods and fields in existing or new classes are not visible to reflection

You can follow our progress in dotnet/runtime#57365

Targeting .NET 7

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

<TargetFramework>net7.0</TargetFramework>

The full set of .NET 7 TFMs, including operating-specific ones follows.

  • net7.0
  • net7.0-android
  • net7.0-ios
  • net7.0-maccatalyst
  • net7.0-macos
  • net7.0-tvos
  • net7.0-windows

We expect that upgrading from .NET 6 to .NET 7 should be straightforward. Please report any breaking changes that you discover in the process of testing existing apps with .NET 7.

Closing

A global and diverse team of engineers at Microsoft in collaboration with a highly engaged community of developers are building .NET 7. The broad .NET community, including everyone from students and hobbyists to open-source contributors and enterprise customers, are at the heart of .NET. They propose new ideas, contribute code regularly, and drive the .NET ecosystem forward. We appreciate and thank you for your support, contributions and insights.

Welcome to .NET 7.

Author

Jeremy Likness
Principal Program Manager - .NET Web Frameworks

Jeremy is a Principal Program Manager for .NET Web Frameworks at Microsoft. Jeremy wrote his first program in 1982, was recognized in the "who's who in Quake" list for programming the first implementation of "Midnight Capture the Flag" in Quake C and has been developing enterprise applications for 25 years with a primary focus on web-based delivery of line of business applications. Jeremy is the author of four technology books, a former 8-year Microsoft MVP for Developer Tools and Technologies, ...

More about author

30 comments

Discussion is closed. Login to edit/delete existing comments.

  • Phil Wang

    I have only one question: where is the future of uwp? I’ve invested too much in my current project. since .Net 5 Microsoft is deliberately ignoring this topic. Please give a clear answer.

  • Amir H

    And what happens to the UWP now?

    • Phil Wang

      I have same question.

      • Ruslan Smirnov

        Wasn’t UWP formally killed off like 2 years ago? I thought WinUI is meant to be the end-all next-gen UI framework.

  • Captain Flack

    I would rather the time was spent on extending .NET to cover things left behind with the .NET Framework, like webforms, which has a massive user base. Aside from the huge amount of legacy code, there are many developers like myself who despite having experience in Blazor and MVC, still appreciate the role it plays. It is still the best way to create complex form interfaces without a bunch of flakey clientside code and exposed...

    Read more
  • Jon Miller

    This "modern" stuff is a joke. What is "modern"? Make everything run in the cloud where Microsoft can make money off it? You aren't making things better. Why doesn't your cross platform UI run on Linux? This will just be a repeat of Silverlight. Dropped in a few years after everyone rejects it. You should be making development easier. You aren't. That's the bottom line. You should have kept Web Forms instead of parroting Ruby...

    Read more
  • Ian Marteens

    So, no news about AOT?

  • Frederic Forjan · Edited

    WPF roadmap for .NET 7 ?

    When I look at the link you have - https://github.com/dotnet/wpf/blob/main/roadmap.md - and search for .NET 7, there is no result.
    Looking at the table I do not see any info for .NET 7.0, just either ongoing activities not refreshed for .NET 7.0 - someone in the team spending 3 minutes to update the wording would have been a minimum - or some project management items - review & testing.

    So...

    Read more
  • Renee GA

    I really hope we can get a designer for WinUI/MAUI. Live preview is cool but is not a replacement for it.

    • anonymous

      this comment has been deleted.

      • Huegle, Fabian

        I believe WinUI 3.0 unpackaged apps has been a goal as well. Any updates on this?

    • Kalixt

      I think that if it was possible to have one, we would have it long time ago in Xamarin. Hot reload got a lot of improvements but yeah, designer is still better.

  • Kale Freeman

    .NET 6 has several noticeable improvements particularly on performance but without MAUI and official Blazor standard controls, it's still a disappointment.

    Hope .NET 7 will redeem itself. Hope that Microsoft will throw much needed investment into MAUI and Blazor to make these a top choice for making applications. I can't fathom how a huge corporation with billions of dollars of net revenue but still acting like a poor startup that couldn't afford to pay enough to...

    Read more
  • MgSam · Edited

    Can you publish documentation or a blog post on the Microsoft.Extensions.* packages? I’ve never heard of most of those. You can write the greatest code in the world- if you don’t publicize it and thus no one uses it it’s ultimately useless.

    Also will there be information about the new C# preview?

    • Jeremy LiknessMicrosoft employee Author

      Hi,

      Various libraries and APIs exist in that namespace. The documentation is specific to each implementation. For example, Microsoft.Extensions.Logging is documented in Logging in .NET and Microsoft.Extensions.DependencyInjection is documented in Dependency injection in .NET. A high-level reference is available via the API browser.

      Read more
      • Martin Sedlmair

        Honestly its very hard to dig into the extension docs. While logging and dep-inj might be documented “quite thorougly” others are definitely not (composition). It would be nice if more invest is done in also documenting these with examples.

  • Alishoooo Esteres

    AOT!?

    • Sébastien Sevrin

      Ahead Of Time

      • Eric Ling

        Attack On Titan