visual-studio 构建为单个 ASP.NET MVC 应用程序的多个 ASP.NET MVC 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1200424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Multiple ASP.NET MVC projects that builds as single ASP.NET MVC Application
提问by Gopinath
We want to split our large asp.net mvc web application into multiple Visual Studio projects so that each team can independently on their visual studio project.
我们希望将我们的大型 asp.net mvc web 应用程序拆分为多个 Visual Studio 项目,以便每个团队可以独立处理他们的 Visual Studio 项目。
Desired structure is:
所需的结构是:
- ASP.NET MVC application that is responsible for the base UI
- Module 1 - VS Project (Does this need to be a ASP.net MVC App or .dll?)
- Module 2 - VS Project (Does this need to be a ASP.net MVC App or .dll?)
- so on....
- 负责基本 UI 的 ASP.NET MVC 应用程序
- 模块 1 - VS 项目(这是否需要是 ASP.net MVC 应用程序或 .dll?)
- 模块 2 - VS 项目(这是否需要是 ASP.net MVC 应用程序或 .dll?)
- 很快....
Each module should contain it's own controller & views that are responsible for functioning of the module. T
每个模块都应该包含它自己的控制器和视图,负责模块的功能。吨
How to split the ASP.NET Application in to multiple projects and then merge them as a single website during build process?
如何将 ASP.NET 应用程序拆分为多个项目,然后在构建过程中将它们合并为一个网站?
采纳答案by Darin Dimitrov
回答by Gopinath
The problem is sorted out by just creating multiple MVC projects and merging the output at the end by simple copy & paste :)
只需创建多个 MVC 项目并在最后通过简单的复制和粘贴合并输出即可解决问题:)
here is the structure we followed:
这是我们遵循的结构:
- MyApp.Web.Shell (just contains themes, css, js & images required for the web app)
- MyApp.Web.Home
- MyApp.Web.UserManagement
- MyApp.Web.DeviceManagement
- MyApp.Web.ContentManagement
- .....etc...
- MyApp.Web.Shell(仅包含 Web 应用程序所需的主题、css、js 和图像)
- 我的应用程序.Web.Home
- MyApp.Web.UserManagement
- MyApp.Web.DeviceManagement
- MyApp.Web.ContentManagement
- .....等等...
At the end we are using build scripts to merge output of all the projects and generate the files required for the total web app to run.
最后,我们使用构建脚本来合并所有项目的输出并生成运行整个 Web 应用程序所需的文件。
If you need any help in implementing similar solution, get in touch with me at link text
回答by JaredPar
One tool you may be interested in looking at is called ILMerge
您可能有兴趣查看的一种工具称为 ILMerge
This is a tool that will allow you to merge several .Net assemblies into a single DLL. It could be used to combine the output of your several projects into a single DLL for deployment.
这是一个允许您将多个 .Net 程序集合并为一个 DLL 的工具。它可用于将多个项目的输出组合到单个 DLL 中以进行部署。
I haven't ever tried it with Asp.Net MVC and I'm not familiar enough with the MVC architecture to say whether or not it will work for your situation. But it's likely worth a try.
我从来没有用 Asp.Net MVC 尝试过它,而且我对 MVC 架构不够熟悉,无法说明它是否适用于您的情况。但这可能值得一试。
回答by Sachin Chavan
Follow this link it will solve you problem.
按照这个链接它会解决你的问题。
Takes just 10 mins to complete the walk-through.
只需 10 分钟即可完成步行。
Walkthrough: Organizing an ASP.NET MVC Application by Logical Areas
回答by MunkiPhD
You could just use good Source Control and have the respective teams check out what they need to work on.
您可以使用良好的源代码控制,并让各自的团队检查他们需要做什么。
This way you have only one dll at compile time...
这样你在编译时只有一个 dll ......
回答by Beep beep
If your app doesn't require areas, and your goal is just to allow team independence, why not just use a better source code control system? Unless you have truly independent modules, sounds like managing via branches in subversion is appropriate.
如果您的应用程序不需要区域,而您的目标只是让团队独立,为什么不使用更好的源代码控制系统呢?除非你有真正独立的模块,听起来像在 subversion 中通过分支管理是合适的。
回答by Kevin Jones
One way we handled this in my previous job was to build a master 'controller' application. This app was deployed and was public facing. It's job was to read the incoming URL and, based on a bunch of mapping rules in config files, map that URL to other MVC applications running on the same server. This gave us lots of options such as being able to run the backing apps on different servers in the farm if we wanted to do crude load balancing. You need to manage things such as authentication across the multiple apps (if you're using authentication).
我们在之前的工作中处理这个问题的一种方法是构建一个主“控制器”应用程序。此应用程序已部署并面向公众。它的工作是读取传入的 URL,并根据配置文件中的一系列映射规则,将该 URL 映射到运行在同一服务器上的其他 MVC 应用程序。这为我们提供了很多选择,例如如果我们想要进行粗略的负载平衡,可以在场中的不同服务器上运行支持应用程序。您需要管理诸如跨多个应用程序的身份验证之类的事情(如果您使用身份验证)。
This basically gives you the ability to have as many different MVC apps as you need running on the servers all with the same front controller (essentially)
这基本上使您能够在所有具有相同前端控制器的服务器上运行所需数量的不同 MVC 应用程序(基本上)

