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?
Asked
Active
Viewed 864 times
3
-
Just a nitpick really but [MEF isn't an IoC tool](http://stackoverflow.com/questions/216565/why-exactly-isnt-mef-a-di-ioc-container). – Roman May 09 '11 at 17:24
1 Answers
1
By default views are not compiled so you should be able to do this without any extra work.

Adam Flanagan
- 3,052
- 23
- 31
-
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
" – ActionJackson May 09 '11 at 16:18 -
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. – Adam Flanagan May 09 '11 at 17:33
-
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? – ActionJackson May 09 '11 at 18:14
-
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. – Adam Flanagan May 09 '11 at 18:30
-
Adam, is your plugins folder in a specific location? How does your action method in your controller look? – ActionJackson May 09 '11 at 19:01
-
I'm not using any plugins folder, just the default MVC folder structure. So for controller Foo and action Bar I would just `return View();` which would look for /Views/Foo/Bar.cshtml Are you using a different folder structure? – Adam Flanagan May 09 '11 at 19:34
-
I have a separate folder outside of the the Views folder which is the designated repository for MEF plugins. Are you using MEF (or any other method to bring in views that are not a part of the core web application)? – ActionJackson May 09 '11 at 19:49