Reputation: 3506
Ever since ASP.NET entered the scene, there has never been a clean out-of-the-box way to create a library (views + code) that you could easily deploy within an ASP.NET site.
So, if we take the scenario where you have a solution with:
As far as controllers or code-behind goes, that's easy enough to deal with. The latter are just compiled into the class library, the former are part of the class library too and can easily be detected by convention in the web app. Now for views, be it ascx, aspx or cshtml, it becomes a different story. As far as I can tell, these are the options:
Embedded views, served through a VirtualPathProvider. You keep the run-time compilation, but you cannot change the view from within the web site, though you can set it up to hook into the fallback chain of available view locations.
Compiled views. This basically boils down to the code-behind scenario. I think the same remarks hold as for embedded views.
NuGet package which copies over the view files. Seems the most feasible, but also imposes unwanted build overhead.
My main problem is that there's no one-size-fits-all scenario to facilitate both development and production deployment, that:
I'm curious how other developers deal with this, and if anyone found a way of dealing with all these issues?
Edit: note that I am aware of the fact that a lot of CMS's do facilitate it in some way, but so far, I have not encountered the one that solves the above stuff.
Upvotes: 1
Views: 309
Reputation: 11
You can take a look at Orchard CMS. It is developed as a modular framework which addresses your problems perfectly. It has best practices for implementing an ASP.NET MVC framework for your own.
"It supportsbthe ability to dynamically compile modules deployed as source code only. This is more flexible than deploying binaries, and enables some interesting scenarios such as "in place" code customization without having to use Visual Studio."
Upvotes: 1