Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Guidance for loading external views #3445

Closed
lszomoru opened this issue Oct 30, 2015 · 2 comments
Closed

Guidance for loading external views #3445

lszomoru opened this issue Oct 30, 2015 · 2 comments
Assignees
Labels

Comments

@lszomoru
Copy link

Is there a way (or are there any plans) to support loading view components (both the controller and the view) from an ASP.NET class library? I also noticed that at the moment one can add a project reference from one MVC application to another within the same solution. Is this expected behavior? What is the potential scenario that is covered by such a reference? I am asking as this would work perfectly for me if the views from the referenced MVC application would be discoverable by the rendering engine. Thanks!

@louislewis2
Copy link

I am also looking for such a feature. Being able to have views discoverable when they reside in class libraries would be a fantastic addition to the framework. Currently controllers are no issue at all, but having to 'split' views from controllers seems a bit unfinished.

@lszomoru
Copy link
Author

It turns out that you are able to load views from a referenced class library using the EmbeddedFileProvider. The limitation of this approach is that all your views would have to be loaded from one class library. There is currently a pull request out (aspnet/FileSystem#142) to add a CombinedFileProvider which would allow you to combine the default PhysicalFileProvider with one or more EmbeddedFileProviders. There is still an on-going issue with packaging and extracting static files from a class library but that is currently discussed in dotnet/aspnetcore#651.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants