Controllers in another Assembly in MVC

I was looking for information about putting controllers in a seperate assembly(dll) as a test to see whether I would be able to create some sort of plugin mechanims where the plugin assembly contains the controllers needed for that plugin.

I came across this post in a forum which simply stated says that you need to do this:

  1. Create your web application
  2. Create your class library for your controllers
    1. Reference the System.Web.Extensions.dll
    2. Reference the System.Web.MVC.dll
  3. From your web application, reference the class library

And that is it! You can create your controllers in the class library and everything will just work (Except you won’t be able to right click on an action and click “Add View…” and some of the other nice thing like that!)

It seems that the MVC framework looks in the whole appdomain for any class that implements IController…

Advertisements