Visual Studio解决方案中的多个Web应用程序项目 [英] Multiple web applications projects within a visual studio solution

查看:632
本文介绍了Visual Studio解决方案中的多个Web应用程序项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前开始使用ASP.Net Web表单一个新网站的发展。为了让这个项目有正确的开始,我调查的一个Visual Studio解决方案安装应用程序,在这里我想我的应用程序包括那些大小相等很容易辨认组件(code线)。

I am currently starting the development of a new website using ASP.Net Webforms. To give this project a proper start I am investigating a visual studio solution setup for the application, where I want my application to consist of easily recognizable components that are equal in size (lines of code).

由于该项目还没有真正开始我却构造的解决方案在一个标准的三层设置(数据,业务逻辑和presentation)。这种设置是罚款在项目的开始,但随着项目的发展的三个层级将很快开始变大和导航并找到code会变得更加困难,这将损害可维护性和质量的整体感觉。

Since the project is hasn’t actually started yet I have structured the solution in a standard three tier setup (data, business logic and presentation). This setup is fine at the start of the project but as the project grows the three tiers will soon start to become big and navigating and finding code will become harder which will hurt maintainability and overall feel of quality.

所以,我要转换为新的设置,我形成每个人都有自己的三层设置功能部件项目中。例如:该网站有一个购物车和选项来创建和管理用户帐户。此外,还应该对跨多个组件,我将呼吁共同为这个例子中使用stull组件。这将导致以下设置:

So during the project I want to convert to a new setup where I form functional components that each has their own three tier setup. For example: the website has a shopping cart and options to create and manage a user account. There should also be component for stull used across multiple components, which I will call common for this example. That would lead to the following setup:

常见的文件:


  • Project.Common.Data
  • Project.Common.Business

  • Project.Common。presentations

购物车:


  • Project.Shoppingcart.Data
  • Project.Shoppingcart.Business

  • Project.Shoppingcart。presentations

账户管理:


  • Project.Account.Data
  • Project.Account.Business

  • Project.Account。presentations

网站


  • Project.Website.Data
  • Project.Website.Business

  • Project.Website。presentations

上面的示例有各自包含三个项目三个组成部分。每个组件都有一个包含网页文件(网页,控件,前端code)一种Web应用程序项目。我所有的previous .NET项目都有一个简单的Web应用程序项目,所以这种设置对我来说是一个全新的体验。

The sample above has three components that each contains three projects. Each component has one web application project that contains web files (pages, controls, front-end code). All my previous .Net project all had a simple web application project, so this setup is a new experience for me.

我仍然希望溶液的感觉,一种应用中,能够调试网站和轻松的组件。为了实现这一点,我承担的Project.Web。presentationWeb应用程序项目的主体应该是Web应用程序项目。我目前正在调查是否有可能设置这样,我尝试了好几种方法解决,但至今没有行之有效:

I still want the solution to feel as one application, being able to debug the website and the components with ease. To achieve this I assume the "Project.Web.Presentation" web application project should be the main web application project. I am currently investigating if it is possible to setup a solution this way, I have tried several approaches but none have worked well so far:


  • 单独运行的所有Web应用程序项目,这个工作不错,但我必须单独运行的所有应用程序,我不能在调试时,这是可怕的同一端口下运行​​它们。

  • Running all the web application project separately, this worked fine but I have to run all the application separately and I cannot run them under the same port which is terrible when debugging.

添加其他presentation项目文件,链接到Project.Web。presentation项目,并设置项目作为启动项目。这不起作用的文件不是在调试时present,似乎建立一个部署包时,做工精细。我不想因为我要复制的文件以某种方式prevent从版本控制结束了这些重复文件。

Adding files from other presentation projects as links to the "Project.Web.Presentation" project and set that project as startup project. This doesn’t work as the files aren’t present at debug time, seems to work fine when building a deployment package. I do not want to copy the files since I have to somehow prevent those duplicate files from ending up in version control.

到目前为止,我还没有发现有设置我心目中工作的好办法。我很愿意听取建议,在此先感谢的提示!

So far I haven’t found a good way to work with setup I have in mind. I am open to suggestions, thanks in advance for the tips!

推荐答案

我的工作类似的东西,并决定使用的NuGet推了所有的公用部分:

I'm working on something similar and decided to use NuGet to push out all the common parts:

多项目的NuGet问题

在现有的更新文件的NuGet包

<一个href=\"http://stackoverflow.com/questions/5667412/visual-studio-multi-project-solution-options\">Visual工作室多项目解决方案选项

其他唯一的方式做到这一点涉及到嵌套母版页和后构建脚本 - 凌乱

The only other way to do this involves nested master pages and post build scripts - messy.

这篇关于Visual Studio解决方案中的多个Web应用程序项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆