Search code examples
c#winformsdirectory-structureproject-structurevisual-studio-project

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


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?


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: What is the optimum number of projects in a Visual Studio 2008 solution?