使用同一个Visual Studio解决方案中的多个项目的时机是什么?

huangapple go评论97阅读模式
英文:

When to use multiple projects on the same Visual Studio solution?

问题

我正在开发一个WinForms应用程序,它位于一个更大的主要WinForms应用程序内,该应用程序启动其他窗体。

您有一个包含可以单击并启动的应用程序的大菜单(我的应用程序是其中之一)。在项目的开始阶段,我被建议将所有内容都放在项目解决方案文件的一个单独文件夹内:

MainProject0.1/
├─ .git/
├─ MainProject/
│  ├─ MyOwnSeparateForm/
│  │  ├─ MyForm.cs
│  ├─ MainForm.cs
├─ .gitignore
├─ MainProject.sln

我当时同意这样做,因为主应用程序和我的窗体之间的依赖关系不大,最坏的情况下,我们只是使用了一些图标的相同资源图片。

但现在我在考虑这是否是最优的做法,随着项目的增长,这可能会变得很麻烦。那么,我是否真的应该为我的窗体创建一个单独的项目,并将其包含在解决方案中呢?

英文:

I'm working on a WinForms app, inside a bigger, main WinForms app that launches other Forms.

You have a big menu with apps you can click and launch (mine is one of them). At the beginning of the project, I've been recommended to create everything inside a separate folder in the project's solution files:

MainProject0.1/
├─ .git/
├─ MainProject/
│  ├─ MyOwnSeparateForm/
│  │  ├─ MyForm.cs
│  ├─ MainForm.cs
├─ .gitignore
├─ MainProject.sln

I was ok with it because there's not much dependency between the main app and my form, at worst we just use the same resource picture for some icons.

But now I've been thinking this isn't optimal and would be a pain later as the project grows. So should I really create a separate project for my Form and include in the solution?

答案1

得分: 0

从我的经验来看,我在解决方案中创建新项目,例如将业务逻辑与用户界面分开,或者为服务甚至接口创建新项目。

我不知道是否有关于这个主题的任何指南,所以我只会从我的角度说... 如果我必须创建一个应用程序,如你所描述的,它将是较小应用程序的中心,我认为我会为每个小应用程序创建一个单独的项目,以及一个单独的项目用于中心应用程序(当然在一个解决方案中)。

还有相关的问题:https://stackoverflow.com/questions/338067/what-is-the-optimum-number-of-projects-in-a-visual-studio-2008-solution

英文:

From my experience I create new project in a solution to for example separate business logic from the UI or I create a new project for the services or even interfaces.

I don't know if there are any guidelines regarding this topic so I will speak only from my perspective... if I had to create an app that, as you described, would be a hub for smaller apps I think I would create a separate project for each of the small apps as well as a separate project for the hub application (in one solution of course).

Also related question: https://stackoverflow.com/questions/338067/what-is-the-optimum-number-of-projects-in-a-visual-studio-2008-solution

huangapple
  • 本文由 发表于 2023年7月3日 22:54:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605888.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定