I have a shared component library where each micro component has it's own namespace.
In previous versions of blazor it was possible to use the taghelper to import such components with a root namespace. Now with the preview4 version i have to specify each namespace in the _Include file or on each page i'd like to use such a shared component.
Is there any plan to add a more generic solution for such imports or at least a better auto resolve on the page level? Because without the using declaration the component will not be rendered.
@addTagHelper *, My.Components
@using My.Components.ComponentA
@using My.Components.ComponentB
@using My.Components.ComponentC
Yup, just been affected by this change too.
It would also be nice if you could specify the namespace of a component manually like @namespace MyLib
Nevermind ... I thought that the notation in the blog post was new. @danroth27 See the @using statement in the _Imports.razor section of the blog post. It ends with a period. Will be fixed in the docs by https://github.com/aspnet/AspNetCore.Docs/pull/12086.
I have a shared component library where each micro component has it's own namespace.
I would suggest designing your components namespaces like you would any other types. Functionality that you expect to be used together should be grouped together. Avoid namespaces that are too granular.
It's definitely our plan for component namespaces to function like normal .NET/C# namespaces.
What do you think is valuable about putting components in really granular namespaces?
The issue here is that for C# classes you can nest them in different folders but keep a single (simple) namespace. For components, the namespace is being autogenerated based on the path, which is fine, but it would be nice to be able to specify the namespace manually too.
MyModule/Components/HelloWorld/Hello.razor
@namespace MyModule.Components
We plan to support @namespace for preview 6 https://github.com/aspnet/AspNetCore/issues/8007
awesome, thanks
Closing this in favor of #8007.
Most helpful comment
We plan to support
@namespacefor preview 6 https://github.com/aspnet/AspNetCore/issues/8007