Table of Contents
Web Apps-Choose an ASP.NET Core server and client rendered web UI
server rendered ASP.NET Core UI solution
ASP.NET Core Razor Pages
ASP.NET Core MVC
client rendered ASP.NET Core solution
Blazor-Blazor hosting options
Blazor Server
Blazor WebAssembly
.Net core 6.x
5 New .NET 6 Features to be released
Hot Reload for ASP.NET Core #18486
Reimplement the Razor compiler using source generators & support incrementality #26902
ASP.NET Core and SPAs in .NET 6 #27887
Epic: Minimal hosting and actions #32378
Epic: Minimal API - OpenAPI features #34514
Servers
[Epic] HTTP/3 support in ASP.NET Core #15271
Address file-locking issue in IIS #27395
MVC & APIs
Add Streaming API support to MVC #11558
Support IAsyncDisposable in MVC #13150
Css Isolation for Asp.Net Core Web Application for .cshtml files #25713
Provide an API experience that scales down well and is easier to learn #27724
Blazor
Hot Reload for Blazor #5456
AoT compilation #5466
Add support for launching DebugProxy from blazorwasm debug type in VS Code #22587
Infer component generic types from ancestor components #29349
Blazor Server Improvements
Support byte-array transfer in JS Interop #21877
Support Streaming Interop in Blazor #30289
Specific component for dealing with large amounts of text data (InputTextArea) #30291
Support custom event args in Blazor #17552
Required parameters to blazor components #11815
Allow generic type constraints #8433
Add support for error boundaries in Blazor #26953
Dynamically added root components #27574
Support binding to <select multiple>, getting/setting the selection as an array #5519
Update Blazor <head> components #25705
Improve SVG support in Blazor #18271
Production stress tests were conducted using Microsoft services, cloud applications run by other companies, and open-source projects.
Supported for three years as the latest long-term support (LTS) version.
A unified platform across browsers, cloud, desktop, IoT and mobile applications, all applications use the same .NET library and the ability to easily share code.
Overall performance is improved, especially file I/O, which reduces execution time, latency and memory usage.
C# 10 provides language improvements, such as record structure, implicit use, and new lambda features, while the compiler adds an incremental source generator.
F# 6 adds new features, including task-based asynchrony, pipeline debugging, and numerous performance improvements.
Visual Basic has been improved in the Visual Studio experience and the Windows Forms project opening experience.
Hot reloading allows users to skip rebuilding and restarting the application to see the new changes supported in Visual Studio 2022 and .NET CLI, suitable for C# and Visual Basic.
Cloud diagnostics have been improved through OpenTelemetry and don’t monitor, and are now supported in production and can be used for Azure App Service.
JSON API is more powerful, has higher performance, source generator with a serializer.
The minimal API is introduced in ASP.NET Core to simplify the onboarding experience and improve the performance of HTTP services.
Blazor components can now be rendered from JavaScript and integrated with existing JavaScript-based applications.
WebAssembly AOT compilation for Blazor WebAssembly (Wasm) applications, and support for runtime relinking and native dependencies.
Single-page applications built with ASP.NET Core now use a more flexible model that can be used with Angular, React, and other popular front-end JavaScript frameworks.
HTTP/3 has been added so that ASP.NET Core, HttpClient and gRPC can all interact with HTTP/3 clients and servers.
File IO now supports symbolic links and has greatly improved performance through the rewritten FileStream.
By supporting OpenSSL 3, ChaCha20Poly1305 encryption schemes and runtime defense-in-depth mitigation measures, especially W^X and CET, security has been improved.
Single-file applications (without extraction) can be released for Linux, macOS, and Windows (previously only available for Linux).
IL trimming is now more powerful and effective, and new warnings and analyzers ensure correct final results.
A source code generator and analyzer have been added to help users generate better, safer, and higher-performance code.
Source code builds enable organizations such as Red Hat to build .NET from source code and provide their own builds to their users.
.Net core 5.x
.NET 5.0 includes the following improvements and new features compared to .NET Core 3.1
C# updates
F# updates
Visual Basic updates
System.Text.Json new features
Single file apps
App trimming
Windows ARM64 and ARM64 intrinsics
Tooling support for dump debugging
The runtime libraries are 80% annotated for nullable reference types
Performance improvements:
Garbage Collection (GC)
System.Text.Json
System.Text.RegularExpressions
Async ValueTask pooling
Container size optimizations
Many more areas
What's new in .NET 5
https://docs.microsoft.com/en-us/dotnet/core/dotnet-five
微软将此新版本命名为.NET 5.0而不是.NET Core 4.0的原因有两个:
1.跳过版本号4.x,以避免与.NET Framework 4.x混淆。
2.从名称中删除了“ Core”,以强调这是.NET未来的主要实现。与.NET Core或.NET Framework相比,.NET 5.0支持更多类型的应用程序和平台。
ASP.NET Core 5.0基于.NET 5.0,但保留名称“ Core”以避免将其与ASP.NET MVC 5混淆。
同样,Entity Framework Core 5.0保留名称“ Core”以避免将其与Entity Framework 5和6混淆。
.Net core 3.x
ASP.NET Core 3.0 and over removed the option to run on .NET Full Framework 4.x. It only runs on .NET Core, meaning you can no longer fall back to .NET Full Framework 4.x for COM Interop support.
ASP.NET Core 3.0 不支持 .NET Full Framework 4.x。
1、用于在 .NET Framework 和所有其他平台之间共享代码,使用 netstandard2.0
2、用于在 Mono,Xamarin 和 .NET Core 3.x 之间共享代码,使用 netstandard2.1
3、微软停止更新 .NET Standard,用.NET 5 取代
.Net Core 2.x
2017, around the time .NET Core 2.0 was being released
Whai is diffrent betwen in ASP.NET Core 2.0 and ASP.NET Core 1.0
http://www.talkingdotnet.com/whats-new-in-asp-net-core-2-0/
Quick summary of what’s new in ASP.NET Core 2.0
ASP.NET Core 2.0 Preview 1 is already out and you can start building application with ASP.NET Core 2.0. At the time of writing this post, it is still in Preview 1 and final version is expected to be released in Q3-2017. To build ASP.NET Core 2.0 based application, you need to install Visual Studio 2017 Preview 3. Since this is a major release, expect some code breaking changes and a few new pieces. In this post, I try to put together a quick and short summary of what’s new in ASP.NET Core 2.0 compared to ASP.NET Core 1.1.
Here is what’s new in ASP.NET Core 2.0
If you are new to ASP.NET Core, please read first, Quick summary of what’s changed in ASP.NET Core and you can also check out my other post for ASP.NET Core 1.0. Let’s see what’s new in ASP.NET Core 2.0.
- ASP.NET Core 2.0 implements .NET Standard 2.0. This allows you to use missing .NET Framework pieces with ASP.NET Core like Datasets, Binary Serialization, Reflection and many other pieces. Read What’s new in .NET Standard 2.0
- ASP.NET Core application can be created via dotnet cli also. The following command creates a new ASP.NET Core web application.
dotnet new web
Once this command is completed, you need to execute another command to restore all the packages.
dotnet restore
You don’t have to execute this extra command with .NET Core 2.0. Restoring packages is now part of the
dotnet new
command. - ASP.NET Core 2.0 application now references a single meta package
Microsoft.AspNetCore.All
to include all ASP.NET Core packages with the product version. This makes .csproj file short and clean. Here is a sample ASP.NET Core 2.0 sample .csproj file (Line no. 13).
It is a super easy way to include all the ASP.NET Core packages reference without worrying about their different version. You no longer have to pick individual ASP.NET Core packages. But wait, when ASP.NET Core was introduced, there was so much hype about being modular and bring only what is needed. For example, If you want MVC then include its package. Many developers liked this as it brings down the size of the application. So are we moving from being modular?The answer is NO. If you don’t like this package of packages thing, you can still follow the traditional way of including needed packages. Then, why this one big package is introduced? Well, maintaining, updating and removing unwanted packages requires some efforts and it’s kind-of painful. The other problem would be to remember the package name.
By now, you must be cursing Microsoft and concerned as this would add unnecessary crap to your application, restoring will take ages and make your application heavy. You have already started thinking about the performance of the application :). Your concern is right, but stop cursing Microsoft because, the .NET Core SDK already has all the packages included inside of
Microsoft.AspNetCore.All
, so you are never downloading them from the web. It is all available on your machine. Phew!!!What about Deployment? Well, if there are features you don’t need in your application, the new package trimming features will exclude those binaries in your published application output by default.
- ASP.NET Core 2.0 introduces a new way to build web host configuration. This new approach sets the defaults of the web host configuration using
WebHost.CreateDefaultBuilder()
API.
Familiar Program.cs (ASP.NET Core 1.1)
In ASP.NET Core 2.0, it looks like this:BuildWebHost
is an expression bodied function member introduced in C# 6. This method calls a static methodCreateDefaultBuilder
which adds Kestrel, IIS configuration, default configuration sources, logging providers, and the content root. Instead of you doing all this, theCreateDefaultBuilder
will do it for you. You can take a look at the code of this function here. - Logging and building configuration is no longer part of
Startup.cs
file. It is now part ofCreateDefaultBuilder
, called inProgram.cs
.Startup.cs
in ASP.NET Core 1.1 project looks like this:
In ASP.NET Core 2.0, it looks like this:
As you can see, the constructor no longer takesIHostingEnvironment
, instead takes theIConfiguration
injected dependency and sets the Configuration property for later access if needed. Another change is in theConfigure
method as logging is no longer part of this method. - ASP.NET Core 2.0 introduces Razor Pages. Razor Pages are simple pages or views without controllers associated to it. Razor pages are included with
Microsoft.AspNetCore.Mvc
package. They work on the convention and needs to be placed in Pages folder and the extension is .cshtml. Following is a sample razor code page.
They must use@page
directive on top as the first directive. You can write razor page with inline model (using@functions
directive), separate page models (called Pages Models) and with no models. Routing works quite well with Razor pages. Please visit the official documentation for more details. - The Platform Abstraction API responsible for application environment information is removed. Please visit this link to find out the replacement.
- Authentication has undergone some major changes for 2.0. All Auth middleware are services now and there is now only a single authentication middleware is needed which is
app.UseAuthentication()
. In .NET Core 1.1, to enable cookie authentication,
The options w.r.t. to cookie authentication is specified inConfigure()
method. This is changed in 2.0. Now, it is done like this:
As you can see,Configure()
method now just adds the authentication middleware to pipeline without specifying any configurable options for authentication mechanism. The following table shows name changes of some of the authentication middleware.
ASP.NET Core 1.1 | ASP.NET Core 2.0 |
---|---|
app.UseOpenIdConnectAuthentication | services.AddOpenIdConnectAuthentication |
app.UseJwtBearerAuthentication | services.AddJwtBearerAuthentication |
app.UseFacebookAuthentication | services.AddFacebookAuthentication |
For more details, take a look at this github link.
You can also check out this github announcement link for other changes. That’s it.
Summary
Since ASP.NET Core 2.0 is a major release, you would expect some new features and code breaking changes. At the time of writing this post, it is Preview 1 release and things may change when the stable version comes out. This post takes you through a quick summary of what’s new in ASP.NET Core 2.0 based on the Preview 1 release. It is very unlikely that these things will change/update drastically, but you never know with Microsoft. As the history of ASP.NET vNext suggests otherwise.
Thank you for reading. Keep visiting this blog and share this in your network. Please put your thoughts and feedback in the comments section.