Move BasePath into Components.Web - #69118
Conversation
Co-authored-by: javiercn <[email protected]>
|
Hi @Youssef1313. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
| namespace Microsoft.AspNetCore.Components.Endpoints; | ||
| namespace Microsoft.AspNetCore.Components.Web; | ||
|
|
||
| public class BasePathTest |
There was a problem hiding this comment.
@copilot Can his class be moved to src/Components/web/test?
There was a problem hiding this comment.
Moved it to src/Components/Web/test/BasePathTest.cs (commit 9cbec92) — all 3 tests pass there.
Note: pushing is currently blocked in my environment by a repository ruleset ("Cannot create ref due to creations being restricted" for refs/heads/dev/ygerges/basepath-rebased), so the commit may not appear on the PR until that's resolved.
|
It was intentional to get it faster - but fine for me if you want to get it in main first. In general though, during RC2, I personally have always preferred to deal with release/11.0 PR only and then let the automation do its thing to get it in main. |
There was a problem hiding this comment.
🟢 Approval recommended
The API move is consistently applied across templates/samples/tests and public API files, with only a minor test-ownership/discoverability nit.
Pull request overview
Moves the new BasePath Blazor component into the Microsoft.AspNetCore.Components.Web namespace (and corresponding public API surface) so typical Blazor Web apps can use <BasePath /> without adding an extra @using.
Changes:
- Relocates the
BasePathpublic API fromMicrosoft.AspNetCore.Components.EndpointstoMicrosoft.AspNetCore.Components.Web. - Updates shipped templates/samples/testassets to stop importing
Microsoft.AspNetCore.Components.Endpointsjust to useBasePath. - Updates
PublicAPI.Unshipped.txtfiles to reflect the API move between Components assemblies.
File summaries
| File | Description |
|---|---|
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/_Imports.razor | Removes the Endpoints @using now that BasePath is in Components.Web. |
| src/Components/Web/src/PublicAPI.Unshipped.txt | Adds Microsoft.AspNetCore.Components.Web.BasePath to the Web API surface. |
| src/Components/Web/src/BasePath.cs | Changes BasePath namespace to Microsoft.AspNetCore.Components.Web. |
| src/Components/test/testassets/Components.TestServer/RazorComponents/Root.razor | Removes Endpoints @using while still using <BasePath />. |
| src/Components/test/testassets/Components.TestServer/RazorComponents/RemoteAuthenticationApp.razor | Removes Endpoints @using while still using <BasePath />. |
| src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/ResourceCollection/Index.razor | Removes Endpoints @using (no longer needed). |
| src/Components/test/testassets/Components.TestServer/RazorComponents/NamedFormContextNoFormContextApp.razor | Removes Endpoints @using while still using <BasePath />. |
| src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor | Removes Endpoints @using while still using <BasePath />. |
| src/Components/Samples/BlazorWebAppPerPage/Components/_Imports.razor | Removes Endpoints @using now that BasePath is in Components.Web. |
| src/Components/Samples/BlazorWebAppGlobal/Components/_Imports.razor | Removes Endpoints @using now that BasePath is in Components.Web. |
| src/Components/Endpoints/test/Routing/BasePathTest.cs | Updates test namespace to Microsoft.AspNetCore.Components.Web. |
| src/Components/Endpoints/src/PublicAPI.Unshipped.txt | Removes the BasePath API entries from the Endpoints surface. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| #nullable enable | ||
|
|
||
| namespace Microsoft.AspNetCore.Components.Endpoints; | ||
| namespace Microsoft.AspNetCore.Components.Web; |
Move BasePath into Components.Web
BasePathis a new component (public API) introduced in .NET 11 Preview 1. It was put in the wrong namespace (and wrong assembly).Description
We added BasePath in #64590, but it requires users to pay attention to the namespaces they imported and add an additional
@using.Fixes #69115
Customer Impact
The change makes it for a more friendly usage of a new component that we added in .NET 11.
Regression?
No
Risk
Low.
BasePath is a new component in .NET 11 and the change here is just the namespace.
Verification
No verification needed. This is a public API change.
Packaging changes reviewed?
N/A