ASP.NET Core updates in .NET 6 Preview 1

Sourabh Shirhatti [MSFT]

.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:

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?

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!

15 comments

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

  • Peter Stewart 0

    without loosing app state
    *losing

    • Daniel RothMicrosoft employee 0

      Thanks! Fixed.

  • Robert Letts 0

    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 me hope, so thanks guys for giving me a chance to renew my life after I get out of Poverty Prison.

  • Enrique Ledesma 0

    ASP.NET Core for . NET 6 si new versión of ASP.NET Core for .NET 5??.

    • Daniel RothMicrosoft employee 0

      Hi Enrique. ASP.NET Core for .NET 6 will target .NET 6, not .NET 5.

  • mathieux bergeron 0

    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?

  • Jiří Zídek 0

    Any plans to ease use of Svelte or inculde some svelteish approach in Blazor ?

    • Daniel RothMicrosoft employee 0

      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.

  • Antonio Matos 0

    I’m searching detail documentation for DynamicComponent and not finding it

  • Alexander Paskhin 0

    It will be nice to have some templates features in the IConfiguration.
    There are some that can be used as input Configuration.Formatter

  • Yasser SASSI 0

    Any updates on hot reload for blazor ?

    • Daniel RothMicrosoft employee 0

      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.

Feedback usabilla icon