.NET 5 Preview 8 is now available and is ready for evaluation. Here’s what’s new in this release:
InputRadio
Blazor componentIAsyncDisposable
for Blazor componentsDynamicRouteValueTransformer
dotnet watch
See the .NET 5 release notes for additional details and known issues.
To get started with ASP.NET Core in .NET 5 Preview 8 install the .NET 5 SDK.
You need to use Visual Studio 2019 16.8 Preview 2 or newer to use .NET 5 Preview 8. .NET 5 is also supported with the latest preview of Visual Studio for Mac. To use .NET 5 with Visual Studio Code, install the latest version of the C## extension.
To upgrade an existing ASP.NET Core app from .NET 5 Preview 7 to .NET 5 Preview 8:
5.0.0-preview.8.*
.5.0.0-preview.8.*
.5.0.0-preview.8.*
.That’s it! You should be all ready to go.
See also the full list of breaking changes in ASP.NET Core for .NET 5.
The ASP.NET Core project templates now integrate with Microsoft.Identity.Web to handle authentication with Azure Activity Directory (Azure AD). The Microsoft.Identity.Web package provides a better experience for authentication through Azure AD as well as an easier way to access Azure resources on behalf of your users, including Microsoft Graph. Check out the Microsoft.Identity.Web sample that take you from a simple login through multi-tenancy, using Azure APIs, using Microsoft Graph, and protecting your own APIs. Microsoft.Identity.Web will be generally available alongside .NET 5.
Blazor now supports defining CSS styles that are scoped to a given component. Component specific CSS styles make it easier to reason about the styles in your app and to avoid unintentional side effects from global styles. You define component specific styles in a .razor.css file the matches the name of the .razor file for the component.
For example, let’s say you have a component MyComponent.razor file that looks like this:
MyComponent.razor
<h1>My Component</h1>
<ul class="cool-list">
<li>Item1</li>
<li>Item2</li>
</ul>
You can then define a MyComponent.razor.css with the styles for MyComponent:
MyComponent.razor.css
h1 {
font-family: 'Comic Sans MS'
}
.cool-list li {
color: red;
}
The styles in MyComponent.razor.css will only get applied to the rendered output of MyComponent; the h1
elements rendered by other components, for example, are not affected.
To write a selector in component specific styles that affects child components, use the ::deep
combinator.
.parent ::deep .child {
color: red;
}
By using the ::deep
combinator, only the .parent
class selector is scoped to the component; the .child
class selector is not scoped, and will match content from child components.
Blazor achieves CSS isolation by rewriting the CSS selectors as part of the build so that they only match markup rendered by the component. Blazor then bundles together the rewritten CSS files and makes the bundle available to the app as a static web asset at the path _framework/scoped.styles.css.
While Blazor doesn’t natively support CSS preprocessors like Sass or Less, you can still use CSS preprocessors to generate component specific styles before they are rewritten as part of the building the project.
#aspnetcore #blazor