-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules in indirect NuGet dependency are loaded but not recognized. #17431
Comments
Related: OrchardCMS/OrchardCore.Commerce#456. |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
In case someone tries to implement |
I think the solution with using a |
Describe the bug
Suppose you have two C# projects: A and B. A depends on B, uses services declared by B, etc. Both are marked as modules using the
OrchardCore.Module.Targets
PackageReference. In your web project you import module A using ProjectReference. In module A you import module B using ProjectReference as well. This works as expected, when you go to Admin > Configuration > Features the features for both modules A and B show up without having to explicitly reference B from the web project.But this breaks if you publish A and B as NuGet packages, and only import module A in your web project using PackageReference. In this scenario B is loaded as an indirect reference and the classes in it are available in the web project. But OC won't recognize B as a module, won't load its Startup file, B's features won't show up in the admin feature list. As a consequence when trying to use A you will get "Unable to resolve service" exceptions because services from B are not registered.
If you explicitly add B as PackageReference too, then it works again. But this is impractical and goes against NuGet's design.
Multiple users ran into this problem in OrchardCore.Commerce: only importing the main OrchardCore.Commerce package breaks, because none of the sub modules (Inventory, Payment, Promotion, Tax, etc) are treated as modules.
Orchard Core version
Tested it on 2.1.4 and 1.8.
To Reproduce
<PackageReference Include="OrchardCore.Commerce" />
to the web project.Expected behavior
Features should show up even for indirectly referenced NuGet packages.
Workarounds / Possible Solutions
IModuleNamesProvider
implementation that's recursive.The text was updated successfully, but these errors were encountered: