0

The question I want to ask has been asked before, but I want to know additionally since 2010:

  1. if service packs or MVC4 have improved the story (particularly for views)?
  2. is there a trick that would allow the "Add Controller" wizard to be accessible "in the usual way" from a separate assembly?
  3. is there a trick that would allow the "Add View" wizard to be accessible "in the usual way" from a controller action in a separate assembly?

Rant This rant is not part of my question, but I feel it represents the white elephant in the room.

One response found attached to the above question I linked, suggested that separate MVC assemblies is not pertinent to MVC "separation of concerns." I feel that answer is a bit like saying "future editions of C# will not support interaction between assemblies, because such interaction is not pertinent to Object-Oriented separation of concerns."

Both statements might be technically true, but both statements ignore that separation of concerns applies at ever-increasing levels of scope. In other words, it applies not just at an object or MVC level, but also at a component architecture level as well.

Said differently, just because ASP.NET MVC supports "separation of concerns" at an object (or Area) level, does not mean the story is finished. I would like to see Microsoft simplify the story by adding "ASP.NET MVC Component" templates, which allow for controllers and views (both with working wizards) to be readily part of a separate assembly.

Perhaps someone has already made such a thing?

Community
  • 1
  • 1
Brent Arias
  • 29,277
  • 40
  • 133
  • 234

1 Answers1

1

side note: Any question including a rant will get down voted since it's not very objective. A friendly advice for the future: Keep the questions objective.

Yes, there are indeed tricks available to get the tooling working in other assemblies. I've described it in detail here: http://blog.gauffin.org/2012/05/griffin-mvccontrib-the-plugin-system/

Basically you need to do the following:

  1. Edit the .csproj file of the class library and add the following: <ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
  2. Create a VirtualPathProvider that can read views from other assemblies
  3. Instruct the ASP.NET build manager to include your class libraries when looking for controllers.

.. or just use my open source project Griffin.MvcContrib.

jgauffin
  • 99,844
  • 45
  • 235
  • 372