www.fgks.org   »   [go: up one dir, main page]

ASP.NET Core updates in .NET 6 Preview 1

Avatar

Sourabh

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

14 comments

Comments are closed. Login to edit/delete your existing comments