core icon indicating copy to clipboard operation
core copied to clipboard

Loading ViewComponent from different assembly in .net core 2.1

Open ghost opened this issue 8 years ago • 2 comments

I'm trying to get view components to load from a separate assembly. I posted a question on how to do this on StackOverflow and it doesn't seem like anyone knows how to do this in .net core 2.1. I have also followed some articles but they are old and not working as well. Any chance someone can weigh in on the subject here?

https://stackoverflow.com/questions/52296203/asp-net-core-viewcomponents-in-different-assembly-can-not-be-found

Thanks

ghost avatar Sep 12 '18 15:09 ghost

I've tried it once and only the .cs file could be put in another assembly/project but the cshtml file had to be in the Shared/Components/VIEWCOMPONENT/Default.cshtml.

Here's my test: https://github.com/igoventura/NetCoreViewComponents-Test

igoventura avatar Sep 12 '18 17:09 igoventura

@igoventura there was no problem with the views the problem was in configuration in Startup.cs, See my answer on the post in StackOverflow. Thanks.

ghost avatar Sep 12 '18 20:09 ghost