且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.NET解决方案 - 许多项目对1项目

更新时间:2022-03-22 05:40:58

在我的经验中,分离code这将创建一个可执行文件的多种的项目可有用的,如果你想

In my experience, separating code which creates a single executable in multiple projects can be useful if you want to

  • 使用不同的编程语言在不同的地区,
  • 在开发也使用其他应用程序,或库
  • 在概念上不同的多个层(即,让Visual Studio中保证有从项目中没有直接引用的的项目的应用的)。
  • use different programming languages in different parts,
  • develop libraries that are also used by other applications, or
  • conceptually separate multiple layers (i.e., let Visual Studio ensure that there are no direct references from project Lib to project App).

就个人而言,我最基础的我决定在第二个点。我认为,应用程序的一部分,可以是一个,我可能需要在其他应用更普遍的图书馆吗?把它放在一个单独的项目。否则,正如你指出,有一个单一的项目通常使开发变得更容易。

Personally, I base most of my decisions on the second point. Do I think that part of the application can be a more general library that I am likely to need in other application? Put it in a separate project. Otherwise, as you point out, having a single project usually makes development easier.

关于循环依赖:建议的方法来解决这个是放的接口的引用的东西,到第三个项目。例如,如果你有两个应用程序共享双方通过远程一些对象,你把库项目的共享对象的接口,以保证它们可用于这两个应用程序。

About the circular dependencies: The recommended way to solve this is to put interfaces of the referenced stuff into a third project. For example, if you have two applications both sharing some objects through remoting, you put interfaces of the shared objects in a library project to ensure that they are available to both applications.

不知道你的应用程序的具体设计中,这是很难给出更具体的提醒。

Without knowing the exact design of your application, it's difficult to give more concrete advise.