I'm trying out a plugin mechanism for ASP.NET MVC 3 (razor) using embedded views as described here, I changed the view engine to inherit from the RazorViewEngine, but otherwise didn't really change anything. Now I'm calling a controller action in the plugin assembly, which renders a view, this works ok. But the view cannot find the _viewstart.cshtml, and thus no layout. Ideally I'd like to let the host application define the viewstart and layout. Possibly I shouldn't directly call a plugin controller action though, but rather only render partials from the plugin and let the host application handle the main controllers/views.
These are the viewstart locations that are tried in my own VirtualPathProvider:
"~/Plugins/MyMvcApplication.dll/_ViewStart.cshtml"
"~/Plugins/MyMvcApplication.dll/_ViewStart.vbhtml"
"~/Plugins/_ViewStart.cshtml"
"~/Plugins/_ViewStart.vbhtml"
"~/_ViewStart.cshtml"
"~/_ViewStart.vbhtml"
I'm also considering just forgetting about embedding views as it seems a bit fiddly, so I might just opt for copying views to the host application, which could make debugging easier for future users. The risk is that the users will make changes to these views, making updates of the plugin harder. One of the reasons I have doubts about the plugin mechanism is because of possible performance implications, though I haven't done any measurements yet.