What is new for ASP.NET Core Developers in .NET 6
New features and improvements are introduced in .NET 6 ASP.NET Core and Blazor applications.
If you are not considering ASP.NET Core for your next project then you have to see-sharp
.NET 6 is released and there are many improvements in ASP.NET Core for building modern web applications.
What’s new in .NET 6
Some of the new features and improvements in ASP.NET Core for .NET 6 are:
- Hot Reload: Apply changes to Razor, C#, and CSS source files into your running app during development without the need to rebuild and restart the app.
- Minimal APIs: Create a new ASP.NET Core app with just a few lines of code using the latest C# features and a simplified hosting model.
- Async streaming: Asynchronously stream data from the server without any need for buffering.
- IAsyncDisposable: Support for
IAsyncDisposable
on controllers, page models, and view components. - Bootstrap 5.1: ASP.NET Core now comes with integrated Bootstrap 5.1 support.
- Null-state analysis: All ASP.NET Core templates now have C# null-state analysis enabled by default.
- CSS isolation for pages and views: Scope CSS styles to specific pages or views using .cshtml.css files.
- JavaScript modules: Place related JavaScript modules alongside pages, views, and components using .cshtml.js and .razor.js files.
- Blazor improvements: A lot of Blazor improvements includes Render components from JavaScript, Preserve prerendered state, Error boundaries, Custom event args, Infer generic type parameters from ancestor components, Required component parameters, Handle query string parameters, Control HTML head content, JavaScript initializers, Dynamically render components
- .NET WebAssembly build tools: Ahead-of-time (AOT) compilation for Blazor WebAssembly apps, as well as support for runtime relinking and native dependencies.
- Single-page apps: Built-in support for Angular 12 and React 17 based on a flexible template pattern that can be used with other popular frontend JavaScript frameworks.
- Socket control: More control over socket creation and handling.
- Strongly-typed headers: Accessing HTTP headers in a strongly-typed way.
- HTTP & W3C logging: Log HTTP traffic, and log using the W3C Extended Log File Format.
- HTTP/3 (Preview): Preview of server support for HTTP/3 based on the new QUIC transport.
Upgrade an existing project
To upgrade an existing ASP.NET Core app from .NET 5 to .NET 6, follow the steps in Migrate from ASP.NET Core 5.0 to 6.0
To upgrade an existing ASP.NET Core app from .NET 6 RC2 to .NET 6, update all package references to 6.0.0
.
That’s it! You should be all set to enjoy the benefits of .NET 6.
See also the full list of breaking changes in ASP.NET Core for .NET 6.
Join us for the .NET 6 release at .NET Conf 2021
Come celebrate with us and learn all about the .NET 6 release at .NET Conf 2021, a FREE, three day virtual developer event with over 80 sessions featuring speakers from the .NET team and the broader .NET community. The conference starts tomorrow and goes from November 9–11. We hope you can join us!