Using VirtualPathProvider to load ASP.NET MVC views from DLLs

Solution 1:

  1. You must register your VirtualPathProvider within the Global.asax Application_Start handler.
  2. You must call the view in your DLL using the special path like so: return View("~/Plugin/YOURDLL.dll/FULLNAME_YOUR_VIEW.aspx");

Here's an article with downloadable code sample that demonstrates this:

http://www.wynia.org/wordpress/2008/12/aspnet-mvc-plugins/

Solution 2:

The built-in WebFormsViewEngine uses VirtualPathProviders, so if you write a VPP and register it, you won't need to make any changes to the view engine.