Skip to content

Update package and samples to .NET 10 - #42

Merged
albx merged 2 commits into
mainfrom
41-net10
Aug 29, 2026
Merged

Update package and samples to .NET 10#42
albx merged 2 commits into
mainfrom
41-net10

Conversation

@albx

@albx albx commented Aug 29, 2026

Copy link
Copy Markdown
Owner

This pull request introduces significant updates to modernize the solution and sample projects for the KITT.Web.ReCaptcha library. The main changes include upgrading all projects to .NET 10, updating NuGet dependencies to their latest versions, refactoring asset management to use the new @Assets helper, and updating the Blazor component structure to align with the latest best practices. Additionally, the solution file has been migrated to the new .slnx format.

Project and Dependency Upgrades:

  • All projects (.csproj files) now target .NET 10.0 instead of .NET 8.0, and all Microsoft package references have been updated to version 10.0.11 where applicable. The main library version is also bumped to 2.0.0. [1] [2] [3] [4] [5] [6] [7]

Asset Management and Static Files:

  • All Blazor sample projects now use the new @Assets helper for referencing static assets (CSS, JS), replacing hard-coded paths for improved compatibility with .NET 10's static asset handling. [1] [2] [3]
  • Startup code now uses app.MapStaticAssets() instead of app.UseStaticFiles(), reflecting .NET 10's updated approach to serving static files in Blazor projects. [1] [2] [3]

Solution Structure Modernization:

  • The legacy Visual Studio .sln solution file has been replaced with a new .slnx solution file, which organizes projects and folders in a modern, cross-platform compatible format. [1] [2]

Blazor Component Refactoring:

  • The ReCaptcha v2 component in KITT.Web.ReCaptcha.Blazor now receives its IJSRuntime dependency via constructor injection rather than property injection, and JS interop calls have been updated to use the new pattern. [1] [2]

These changes ensure the codebase is up-to-date with the latest .NET and Blazor features, improve maintainability, and future-proof the project for upcoming releases.

@albx albx linked an issue Aug 29, 2026 that may be closed by this pull request
@albx
albx requested a lite review from Copilot August 29, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The PR description claims all projects were upgraded to .NET 10 but at least one solution-included project remains on net8.0, and there is also a confirmed interop disposal best-practice issue surfaced in the touched Blazor component.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR modernizes the KITT.Web.ReCaptcha library, tests, and sample applications by moving the solution to .NET 10, updating NuGet dependencies, and aligning the Blazor samples with newer static asset patterns (including adoption of the .slnx solution format).

Changes:

  • Upgrade library, test, and sample projects to net10.0 and refresh NuGet package versions (including a major version bump to 2.0.0 for the shipped packages).
  • Update Blazor samples to use app.MapStaticAssets() and the @Assets[...] helper for static asset references.
  • Refactor parts of the API surface to newer C# patterns (e.g., primary constructors) and update tests for newer bUnit/JSInterop APIs.
File summaries
File Description
tests/KITT.Web.ReCaptcha.Http.Test/KITT.Web.ReCaptcha.Http.Test.csproj Targets .NET 10 and updates test/dependency packages.
tests/KITT.Web.ReCaptcha.Blazor.Test/KITT.Web.ReCaptcha.Blazor.Test.csproj Targets .NET 10 and updates bUnit/xUnit tooling packages.
tests/KITT.Web.ReCaptcha.Blazor.Test/v3/ReCaptchaServiceTest.cs Updates bUnit test base type usage for v3 tests.
tests/KITT.Web.ReCaptcha.Blazor.Test/v3/ReCaptchaScriptTest.razor Updates test context inheritance to match new bUnit context type.
tests/KITT.Web.ReCaptcha.Blazor.Test/v2/ReCaptchaTest.razor Updates bUnit context creation and JSInterop expectations for void interop calls.
src/KITT.Web.ReCaptcha.Http/KITT.Web.ReCaptcha.Http.csproj Moves library to net10.0 only, updates package refs, bumps version to 2.0.0.
src/KITT.Web.ReCaptcha.Http/v2/ReCaptchaService.cs Switches to primary-constructor style to align with newer C#/.NET patterns.
src/KITT.Web.ReCaptcha.Http/v3/ReCaptchaService.cs Switches to primary-constructor style to align with newer C#/.NET patterns.
src/KITT.Web.ReCaptcha.Http/v3/ReCaptchaResponse.cs Uses a modern empty collection expression for ErrorCodes.
src/KITT.Web.ReCaptcha.Blazor/KITT.Web.ReCaptcha.Blazor.csproj Targets .NET 10, updates Blazor package refs, bumps version to 2.0.0.
src/KITT.Web.ReCaptcha.Blazor/v2/ReCaptcha.razor.cs Updates JS interop usage and refactors JS runtime injection pattern.
samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/Program.cs Switches sample static-file handling to MapStaticAssets().
samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/Components/App.razor Moves static asset references to @Assets[...].
samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor.csproj Targets .NET 10 and updates WASM server package versions.
samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor.Client/KITT.Web.ReCaptcha.Samples.v2.Blazor.Client.csproj Targets .NET 10 and updates WebAssembly/Http package versions.
samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/Program.cs Switches sample static-file handling to MapStaticAssets().
samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/Components/App.razor Moves static asset references to @Assets[...].
samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor.csproj Targets .NET 10 and updates WASM server package versions.
samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor.Client/KITT.Web.ReCaptcha.Samples.v3.Blazor.Client.csproj Targets .NET 10 and updates WebAssembly/Http package versions.
samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/Program.cs Switches sample static-file handling to MapStaticAssets().
samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/Components/App.razor Moves static asset references to @Assets[...].
samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity.csproj Targets .NET 10 for the server interactivity sample.
KITT.Web.ReCaptcha.slnx Introduces new .slnx solution structure with organized folders/projects.
KITT.Web.ReCaptcha.sln Removes legacy .sln in favor of .slnx.
Review details

Suppressed comments (1)

src/KITT.Web.ReCaptcha.Blazor/v2/ReCaptcha.razor.cs:81

  • DotNetObjectReference.Create(this) creates an IDisposable reference that should be disposed when the component is disposed; otherwise it can leak and keep the component alive longer than intended. Consider storing the reference in a field (e.g., _dotNetRef) and disposing it in DisposeAsync alongside the JS module.
            await module.InvokeVoidAsync(
                "initialize",
                DotNetObjectReference.Create(this),
                Id,
                SiteKey,
  • Files reviewed: 24/24 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread KITT.Web.ReCaptcha.slnx
@albx
albx merged commit a338dfb into main Aug 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update packages to .NET 10

2 participants