Search code examples
c#visual-studio-2017nestednamespacesproject

Nesting projects within projects?


Please forgive my ignorance - I'm not an IT pro (just a 'hobby' programmer) but can anyone advise if it's possible to nest a vs2017 C# project within another project?

I'm thinking of something like:

  • Solution A
    • Project 1
    • Project 2
    • Project 3
      • Project 3A
      • Project 3B

Specifically, I've got a Datalayer project in which I'd like to nest a couple of sub-projects, one to an SQL Server DB and the other to a Neo4j Graph DB. Ideally, I'd like to reference just the Datalayer (Project 3) from Project 1 or 2... I suppose I'm thinking of something similar to dividing functionality using Namespaces?


Solution

  • No, you cannot nest projects. But you can nest namespaces, like namespace SolutionA.Project3.Project3B {}
    Tip: if you want your folder structure to match your namespace structure, first create a folder in Windows Explorer. Than add a folder with the same name in the solution explorer. Then simply add classes etc. to that folder in the solution explorer.