Building reusable Blazor component libraries in .NET 10 Creating reusable component libraries remains one of the best ways to scale Blazor development. .NET 10 brings several improvements that make component libraries cleaner and more powerful. Create a Razor Class Library dotnet new razorclasslib -n MyComponents -o MyComponents Simple reusable component @* MyButton.razor *@ <button class="btn @CssClass" @onclick="OnClick"> @ChildContent </button> @code { [Parameter] public string CssClass { get; set; } = "btn-primary"; [Parameter] public RenderFragment? ChildContent { get; set; } [Parameter] public EventCallback OnClick { get; set; } } .NET 10 improvements useful for component libraries 1. PersistentState attribute You can now declaratively persist component state: [PersistentState] public string? SelectedValue { get; set; } 2. Better static asset handling Static files (including CSS isolation) get automatic fingerprinting and compression when served from a Razor Class Library. 3. Improved JavaScript isolation JavaScript modules from component libraries remain isolated and are easier to consume. 4. Validation improvements DataAnnotations validation now handles nested types more reliably — useful if your components expose complex models. Best practices - Keep components focused - Use [Parameter] + EventCallback - Prefer CSS isolation (.razor.css) - Document public parameters clearly - Consider the [PersistentState] attribute when your components hold state across prerendering Do you maintain your own Blazor component library, or do you mostly use third-party ones? #dotnet #Blazor #dotnet10 #ASPNETCore #ComponentLibrary #ReusableComponents
Открыть в TelegramПосты канала ASP.NET Core
First impressions & breaking changes in .NET 11 ASP.NET Core .NET 11 has been out for a few days. Here’s a practical look at first impressions, things to watch, and code-level differences when upgrading ASP.NET Core apps. Positive first impressions - Runtime Async feels solid (cleaner stacks, lower overhead) - Async validation works well in Minimal APIs and Blazor - Blazor upgrades are practical - OpenAPI 3.2 is a welcome default - Migration from .NET 10 is relatively smooth for most apps Things to watch / potential differences 1. OpenAPI 3.2 schema changes Some schemas generate slightly differently. Example of enabling and pinning version if needed: builder.Services.AddOpenApi(options => { options.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_0; // pin if required }); 2. Async validation attribute Works out of the box, but make sure dependencies are resolved correctly: public class UniqueEmailAttribute : AsyncValidationAttribute { protected override async Task<ValidationResult?> IsValidAsync( object? value, ValidationContext context) { var db = context.GetRequiredService<AppDbContext>(); var exists = await db.Users.AnyAsync(u => u.Email == value as string); return exists ? new ValidationResult("Email taken") : ValidationResult.Success; } } 3. Blazor BasePath New component simplifies sub-path hosting: <BasePath Path="/my-app" /> 4. Package alignment Always update everything together: dotnet add package Microsoft.AspNetCore.OpenApi dotnet list package --outdated Migration tips from RC to GA - Re-test OpenAPI client generation - Verify Blazor enhanced navigation and static assets - Check authentication flows end-to-end - Update all Microsoft.* packages to final 11.0 versions - Run full integration tests Recommendation For most production apps, .NET 10 LTS is still the safer long-term choice. .NET 11 is great for new projects or teams that want the latest features. What has your experience been with .NET 11 so far? Any unexpected issues? #dotnet #ASPNETCore #dotnet11 #Migration #BreakingChanges
Открыть в Telegram.NET 11 launches tomorrow + final reminder for .NET 8/9 Tomorrow (November 10) two important things happen: 1. .NET 11 is expected to reach general availability 2. .NET 8 and .NET 9 reach end of support What to expect from .NET 11: - Runtime Async improvements - Better Blazor (Virtualize, QuickGrid, BasePath, etc.) - OpenAPI 3.2 by default - Async validation for Minimal APIs and Blazor - Native OpenTelemetry attributes - Performance and security updates Final reminder: If you’re still on .NET 8 or .NET 9, tomorrow is the last day these versions receive official security updates and support. Last-minute migration tips: - Prefer .NET 10 LTS for production apps (supported until 2028) - Update TargetFramework, packages, Docker images, and CI - Test authentication, Blazor, and critical endpoints - Keep a rollback plan ready Official download (once available): https://dotnet.microsoft.com/download Are you ready for tomorrow’s release? Reply with Ready, Migrating, or Waiting. #dotnet #ASPNETCore #dotnet11 #dotnet10 #Migration #EndOfSupport
Открыть в TelegramShould you go to .NET 10 LTS or wait for .NET 11? .NET 11 launches on November 10 — the same day .NET 8 and .NET 9 reach end of support. Here’s a practical decision guide. Choose .NET 10 LTS if: - You need long-term support (until November 2028) - Your app is in production or business-critical - You want maximum stability and fewer breaking changes - Your team prefers proven releases over the newest features Consider .NET 11 if: - You want the latest ASP.NET Core features (Runtime Async, better Blazor, OpenAPI 3.2, async validation, etc.) - You’re building a new project or can afford more frequent upgrades - You’re comfortable with STS support - You plan to upgrade again in the next 1–1.5 years anyway Quick recommendation for most teams: Go to .NET 10 LTS now. You get security and support until 2028 with lower risk. You can always move to .NET 11 later if specific features become important. What are you planning to do? Reply with: - ⚡️ — moving to .NET 10 LTS - ❤️ — going straight to .NET 11 - 👌 — staying on current version for now Note: This is a general recommendation based on publicly available information. Always verify the latest support timelines, release status, and breaking changes directly with official Microsoft documentation before making production decisions. Official sources: https://dotnet.microsoft.com/en-us/platform/support/policy https://devblogs.microsoft.com/dotnet/ #dotnet #ASPNETCore #dotnet10 #dotnet11 #Migration #LTS
Открыть в Telegram