.net.net-corecommand-linearchitectureasp.net-core-cli

How to add a Project (.csproj) to Solution (.sln) under a Solution Folder using dotnet CLI (command line)?


I am trying to add a csproj to a sln using dotnet sln command line.

Adding the project is easily achievable using the below command.

  dotnet sln todo.sln add todo-app/todo-app.csproj

But how do I add the same under a Solution Folder


Solution

  • As of .NET Core 3 (preview, test with 3.0.100-preview7-X)

    dotnet sln solution.sln add --solution-folder foo1\foo2\foo3 bar.csproj

    It creates a nested hierarchy as of

    solution.sln
    |
    └───foo1
    │   │
    │   └───foo2
    │       │
    │       └───foo3
    │            │   bar
    │            │   ...