DEV Community

Cover image for Creating a solution from the CLI
Talles L
Talles L

Posted on

Creating a solution from the CLI

For folks that are on Windows and Visual Studio (not Code), solution files (.sln) are still pretty useful.

Below follows the one-liner that I use to quickly create a new .csproj, .sln, and fire Visual Studio from the CLI.

Console application:

dotnet new console -n MyConsoleApp --use-program-main; cd MyConsoleApp; dotnet new sln; dotnet sln add MyConsoleApp.csproj; ii MyConsoleApp.sln;
Enter fullscreen mode Exit fullscreen mode

Web API:

dotnet new webapi -n MyApi --use-program-main; cd MyApi; dotnet new sln; dotnet sln add MyApi.csproj; ii MyApi.sln;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)