question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Root Namespace Imports for Components

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
rynowakcommented, Apr 21, 2019

We plan to support @namespace for preview 6 https://github.com/aspnet/AspNetCore/issues/8007

1reaction
isc30commented, Apr 21, 2019

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Root Namespace Imports for Components #9569
I have a shared component library where each micro component has it's own namespace. ... Support Root Namespace Imports for Components #9569.
Read more >
Is there a way to import all blazor components within a root ...
c# - Is there a way to import all blazor components within a root level namespace between razor class libraries? - Stack Overflow....
Read more >
Add or remove imported namespaces (Visual Basic)
To add a user import · In Solution Explorer, double-click the My Project node for the project. · In the Project Designer, click...
Read more >
Documentation - Namespaces
Another way that you can simplify working with namespaces is to use import q = x.y.z to create shorter names for commonly-used objects....
Read more >
Documentation - Namespaces and Modules
This post outlines the various ways to organize your code using modules and namespaces in TypeScript. We'll also go over some advanced topics...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found