How to reuse Areas, Controllers, Views, Models, Routes in multiple apps or websites

前端 未结 1 477
长情又很酷
长情又很酷 2020-12-02 00:41

I have a test solution which only has one area called Admin.

I would like to reuse Admin across a number of other web applications.

I have a web application

相关标签:
1条回答
  • 2020-12-02 01:21

    Areas cannot be reused the way you think (using virtual directories). They are just an inseparable part of the root web application. They simply embed into the root application routes and cannot function without it. By pointing a virtual directory to your Areas folder you are indicating that this is a separate ASP.NET application but that's far from being the case.

    There are projects like MvcContrib Portable Areas which aim to solve those issues. Worth taking a look. Also if you want to embed some Razor views into an assembly that you could reuse among different ASP.NET MVC 3 applications you may take a look at the following blog post.

    0 讨论(0)
提交回复
热议问题