Reputation: 595
I cannot find a way to create a new solution file using the dotnet core CLI commands described in https://learn.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-sln.
I ran the commands:
dotnet new web -n webtrain
dotnet new classlib -n core
after that, the projects were created correctly, but now I want to create a solution file to group them all, but I cannot find the right command to do that. Anyone knows how to do that?
Upvotes: 41
Views: 34359
Reputation: 21
dotnet new sln
dotnet new classlib -o myclass
dotnet sln add [dir]/myclass.csproj
Upvotes: 2
Reputation: 109
First, you have to create the folder. This will be the solution name. Then run this command inside that folder:
dotnet new sln
This will create a .sln
file in that folder.
Upvotes: 4
Reputation: 36706
looks like you use
dotnet new sln --name mysolution
https://learn.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-new
Upvotes: 82
Reputation: 41
AS I've seen it's a two step operation which consists of: 1 - Creating the Solution file with "dotnet new sln --name mysolution.sln" command in the folder you need and 2 - Add your csproj file to this solution with the command "dotnet sln yourSlnFileYouCreated.sln add PathToTheCsProjFile"
You can remove and add more projects to the same solution file if you want.
https://learn.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-new https://learn.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-sln.
Upvotes: 4