1

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:

  • an ASP.NET site
  • a class library

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:

  1. 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.

  2. Compiled views. This basically boils down to the code-behind scenario. I think the same remarks hold as for embedded views.

  3. 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:

  • keeps your projects nice and tidy: separate project with models, controllers and views
  • fits into you development cycle: just edit a view and try it
  • enabled easy deployment: once developed, apply it to other projects

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.

1 Answer 1

1

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."

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.