问题描述
我试图创建一个web应用,我希望能够以插件单独的程序集。我使用MVC preVIEW 4团结相结合的依赖注入,我用它来创建从我的插件组件控制器。我使用的WebForms(默认ASPX)作为我的视图引擎。
I'm trying to create a webapplication where I want to be able to plug-in separate assemblies. I'm using MVC preview 4 combined with Unity for dependency injection, which I use to create the controllers from my plugin assemblies. I'm using WebForms (default aspx) as my view engine.
如果我想使用视图,我卡上的核心项目中定义,因为ASPX部分的动态编译的是,的人。我在寻找附上在不同的装配ASPX文件的适当的方式,而不必通过整个部署的一步。我失去了一些东西明显?或者我应该诉诸编程方式创建我的意见?
If I want to use a view, I'm stuck on the ones that are defined in the core project, because of the dynamic compiling of the ASPX part. I'm looking for a proper way to enclose ASPX files in a different assembly, without having to go through the whole deployment step. Am I missing something obvious? Or should I resort to creating my views programmatically?
更新:我改变了接受的答案。尽管戴尔的回答是很透彻,我去一个不同的虚拟路径提供了解决方案。它的工作原理就像一个魅力,并在code总共只需约20行,我认为。
Update: I changed the accepted answer. Even though Dale's answer is very thorough, I went for the solution with a different virtual path provider. It works like a charm, and takes only about 20 lines in code altogether I think.
推荐答案
从本质上讲,这是同一个问题,因为人们曾与WebForms和尝试他们的用户控件ASCX文件编译成一个DLL。我发现这个<一个href=\"http://www.$c$cproject.com/KB/aspnet/ASP2UserControlLibrary.aspx\">http://www.$c$cproject.com/KB/aspnet/ASP2UserControlLibrary.aspx这可能为你工作了。
Essentially this is the same issue as people had with WebForms and trying to compile their UserControl ASCX files into a DLL. I found this http://www.codeproject.com/KB/aspnet/ASP2UserControlLibrary.aspx that might work for you too.
这篇关于在ASP.NET MVC单独的程序集的意见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!