I am trying to set up an ASP.NET Core solution with multiple API projects. This architecture is needed as the different APIs need to be individually accessible, but may require each other's functionalities. Currently I am trying to set up the following solution structure:
> Sln (Solution)
> > Modules (Solution folder)
> > > Module One (Solution folder)
> > > > API Two (project)
> > Solution items (Solution folder)
> > API One (project)
However, when I create the API Two project (by right clicking on the Module One solution folder and following the steps in the dialog) it shows up as a folder in the API One project. Essentially an API inside an API.
The folder structure then becomes as follows:
> Sln (Solution)
> > Modules (Solution folder)
> > > Module One (Solution folder)
> > > > API Two (project)
> > > > > API folders, files, etc.
> > Solution items (Solution folder)
> > API One (project)
> > > API folders, files, etc.
> > > API Two (project)
Logically this makes the entire solution break as there are now two endpoints in one API project. However I am confused as to why this is happening in the first place. If I add a project to a solution folder, surely that shouldn't put it in a project folder as well?
The below error is thrown during build when I try to run the project:
CS0017 Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
What am I doing wrong? Is there something critically wrong about my folder structure, or am I just not understanding the way solution folders work? How can I define multiple ASP.NET Core API projects in one solution?
The project is still in a very early stage, so any advice on different approaches or insights are very helpful and much appreciated as well. Do please leave a comment, should you have any questions or require more information.
Thank you in advance!