visual-studioasp.net-coreyeomandnvm

ASP.NET 5 Multiple Projects one solution


I have recently started trying out ASP.NET 5, specifically starting a project with yo-aspnet generator.

I am trying to figure out how to create a solution with multiple projects, like was normal in the pre-ASP.NET 5 days. For example, a solution with a WebApp project, WebApi project, and a unit test project for each.

There does not seem to be a yeoman generator to make a solution structure like this.


Solution

  • You're going to have to structure it yourself if you're just doing it in the command line and not a visual studio solution. So what you would do is have something like:

    MyCoolApp /
    --.gitignore
    --README.md
    --/src
      --MyCoolApp.WebApp
      --MyCoolApp.WebApi
      --MyCoolApp.Domain
    --/test
      --MyCoolApp.Domain.Tests
    

    Which you'll achieve by creating the MyCoolApp folder. cd into it. Do your git init and add a .gitignore from Github. Then make your src and test directories. cd into src. yo generator-aspnet pick WebApplication and name it MyCoolApp.WebApp. Wash/Rinse/Repeat.

    Then in the project.json file add the dependencies to the other projects. You'll probably also want to clean up the duplicate .gitignore files.