开发者

How can I make ASP.NET MVC 3 use views (aspx, ascx) files from an external assembly in my website?

I have an ASP.NET MVC 3 website and I'm looking for a way to package up a set of views and controllers into an external DLL and hopefully use MEF (Dependency Injection) to load the correct controllers and views.

Does anyone know if something like this is possible and any good links to tutorials on 开发者_开发技巧the subject?


Precompiled Razor for Shared Views and Mono

Compile your asp.net mvc Razor views into a seperate dll

A combination of those two will probably get the best result in your case - My precompilation code handles some things the single file generator doesn't, but Chris has more use of out of box code at runtime, which is probably better if you only need to run in a standard mvc3 setup.

I have also used aspx files set up as embedded resources ( Views in separate assemblies in ASP.NET MVC ), but Razor is quite a bit easier to work with in compiled form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜