Has anyone been able to create an Asp.Net Mvc plug-in implementation using MEF (or some other IoC tools) that does NOT require the Razor views to be compiled into dll's? Ideally, I'd like to be able to deploy Razor view changes by simply dropping new files in a folder rather than having to recompile and drop new dll's. Any ideas?
1 Answer
By default views are not compiled so you should be able to do this without any extra work.
7 Comments
ActionJackson
Has this been proven in practice? I keep running into the following error message: "The view at '~/Plugins/Views/Index.cshtml' must derive from WebViewPage, or WebViewPage<TModel>"
Adam Flanagan
This definitely works when using the VS dev server, I'm not able to test with IIS proper at the moment though. The error you mentioned sounds like there is a web.config file missing in your /Views/ folder.
ActionJackson
I added a web.config which is a direct copy of another web.config from another views folder and it still throws the error. I'm really curious how the view could be picked up by the view engine with no problems but the view isn't seen as a legitimate Razor view. Is there more to a Razor view than just the *.cshtml extension?
Adam Flanagan
I've just tested this on full IIS with a default MVC3 project and it works fine. To be honest I'm not sure why you're getting that error. From what I understand a razor view is the .cshtml file, the correct mvc folder structure and a web.config with the appropriate settings for base type, namespaces, config section etc.
ActionJackson
Adam, is your plugins folder in a specific location? How does your action method in your controller look?
|