.NET 6 Preview 1 is now available and ready for evaluation. This is the first preview of .NET 6, the next major update to the .NET platform. .NET 6 is expected to ship in November of this year, and will be a Long Term Support (LTS) release.
If you’re on Windows using Visual Studio, we recommend installing the latest preview of Visual Studio 2019 16.9. If you’re on macOS, we recommend installing the latest preview of Visual Studio 2019 for Mac 8.9.
Major work planned in ASP.NET Core in .NET 6
.NET 6 is using an open planning process, so you can see all of the major themes planned for this release on the Blazor-based themesof.net website. In addition to these top-level themes, we expect to deliver many user driven improvements to the platform as well. You can find a list of the major work planned for ASP.NET Core in .NET 6 in our roadmap issue. Here’s a sampling of some of the major ASP.NET Core features planned for the .NET 6 release:
- Hot reload: Quickly make UI and code updates to running apps without losing app state for faster and more productive developer experience.
- Micro APIs: Simplify building API endpoints with much less code and ceremony.
- Single-file publishing: Build small, standalone, high-performance apps and services.
- WebAssembly ahead-of-time (AoT) compilation: Compile .NET code in Blazor WebAssembly apps directly to WebAssembly when publishing for significantly improved runtime performance.
- Updated single-page app (SPA) support Update SPA integration in ASP.NET Core to work seamlessly with the latest modern front-end JavaScript frameworks.
- Blazor hybrid desktop apps: Combine the best of Blazor and .NET Multi-platform App UI to build cross-platform hybrid desktop apps.
- HTTP/3: Add support for HTTP/3 and QUIC in ASP.NET Core supported servers.
We welcome feedback and participation in the planning and design process on GitHub.
What’s new in ASP.NET Core in .NET 6 Preview 1?
- Support for
IAsyncDisposable
in MVC DynamicComponent
- Input
ElementReference
exposed on relevant components - Nullable reference type annotations
Get started
To get started with ASP.NET Core in .NET 6 Preview 1 install the .NET 6 SDK.
Upgrade an existing project
To upgrade an existing ASP.NET Core app from .NET 5 to .NET 6 Preview 1:
- Update the target framework for your app to
net6.0
. - Update all Microsoft.AspNetCore.* package references to
6.0.0-preview.1.*
. - Update all Microsoft.Extensions.* package references to
6.0.0-preview.1.*
.
See the full list of breaking changes in ASP.NET Core for .NET 6.
Support for IAsyncDisposable
in MVC
You can now implement IAsyncDisposable
on controllers, page models, and view components to asynchronously dispose of resources.
DynamicComponent
DynamicComponent
is a new built-in Blazor component that can be used to dynamically render a component specified by type.
<DynamicComponent Type="@someType" />
Parameters can be passed to the rendered component using a dictionary:
<DynamicComponent Type="@someType" Parameters="@myDictionaryOfParameters" />
@code {
Type someType = ...
IDictionary<string, object> myDictionaryOfParameters = ...
}
Input ElementReference
exposed on relevant components
The relevant built-in input Blazor components now expose a convenient ElementReference
to the underlying input, which simplifies common scenarios like setting the UI focus on the input. The affected components are InputCheckbox
, InputDate
, InputFile
, InputNumber
, InputSelect
, InputText
, and InputTextArea
.
Nullable Reference Type Annotations
We have been applying nullability annotations to parts of ASP.NET Core. A significant number of new APIs were annotated in .NET 6 Preview 1.
By utilizing the new feature in C# 8, ASP.NET Core can provide additional compile-time safety in the handling of reference types like protecting against null reference exceptions. Projects that have opted in to using nullable annotationes may see new build-time warnings from ASP.NET Core APIs.
To enable nullable reference types, you can add the following property to your project file:
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>
For more information, see Nullable reference types.
Give feedback
We hope you enjoy this first preview release of ASP.NET Core in .NET 6. We are eager to hear about your experiences with this release. Let us know what you think by filing issues on GitHub.
Thanks for trying out ASP.NET Core!
Any updates on hot reload for blazor ?
Hot reload is in the works both for ASP.NET Core & Blazor. We should have a public preview to try out in the next few months.
It will be nice to have some templates features in the IConfiguration.
There are some that can be used as input Configuration.Formatter
I’m searching detail documentation for DynamicComponent and not finding it
Hi Antonio,
Does this help?
https://www.youtube.com/watch?v=Wcc14aoylME
Any plans to ease use of Svelte or inculde some svelteish approach in Blazor ?
Hi JiÅ™Ã. We don’t have any specific plans for Svelte in .NET 6, but we are investigating how we can improve the ASP.NET Core experience for working with any frontend JavaScript framework. Hopefully we’ll have more to share on that effort in the months ahead.
I know .net 6 is the version that will target Apple M1 silicon, any news on which preview or RC should support the M1 in the future?
Hi Mathieux. There is initial support for Apple Silicon in .NET 6 Preview 1: https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-1/#support-for-apple-silicon.
ASP.NET Core for . NET 6 si new versión of ASP.NET Core for .NET 5??.
Hi Enrique. ASP.NET Core for .NET 6 will target .NET 6, not .NET 5.
With WebAssembly ahead-of-time (AoT) compilation in .NET 6, already seeing up to a 37% performance improvement in existing .NET 5 RTM code!!
Compare (Select Performance Test Run)
Statistics Simulations in .NET 6 Preview 1 – https://statisticsandblazordotnet6.azureedge.net
Statistics Simulations in .NET 5- https://statisticsandblazordotnet5.azureedge.net
I am really loving this guys! The fast pace, and keeping up with these developments is like chasing a Chicken, and I do love my Roast Chicken! Rocky (Stallone) did finally catch one, according to Dino Esposito in his book on Architecting.NET apps (MS Press 2008), and I love his writing style! The promise that some day I will be able to earn some revenue with these ASP.NET Core creations is giving...
without loosing app state
*losing
Thanks! Fixed.